# pipework

### 安裝 pipework <a href="#an-zhuang-pipework" id="an-zhuang-pipework"></a>

git clone <https://github.com/jpetazzo/pipework.git>\
sudo cp -rp pipework/pipework /usr/local/bin/\
sudo apt-get install arping bridge-utils -y

sudo docker run --name hello --net=none -itd busybox

exit

sudo docker start hello

sudo pipework br0 -i eth0 hello ip/netmask(192.168.43.11/24)@gateway(192.168.43.1)

從HOST機做 ping 測試

sudo pipework br0 hello 192.168.43.11/24\@192.168.43.1(這樣container會多出eth1的介面)

sudo pipework br0 -i eth0 hello 192.168.43.11/24\@192.168.43.1(指定使用container的eth0)

&#x20;ping 192.168.43.11&#x20;

進入容器，檢查網路狀態

![](/files/-Lk7xh7HXklD3YJPq8Zt)

如此，便可讓容器取得與HOST機同網段的ip，讓外網存取

#### 注意，此方法 用於VirtualBox的 Guest OS不適用，你的容器無法存取網際網路，可能與兩次橋接有關，所以若使用VirtualBox使用HOST機相同網段，又希望容器可被網際網路存取，請使用前面介紹的 MacValn模式


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://kawsing.gitbook.io/opensystem/docker-cong-an-zhuang-dao-ying-yong-ru-men-pian/pipework.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
