> For the complete documentation index, see [llms.txt](https://kawsing.gitbook.io/opensystem/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://kawsing.gitbook.io/opensystem/docker-cong-an-zhuang-dao-ying-yong-ru-men-pian/pipework.md).

# 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模式
