VirtualBox 有兩種模式 NAT 以及 Bridge 。
Bridge 設定方式如下。
要先安裝 bridge-utils uml-utilities 兩個套件
sudo apt-get install bridge-utils uml-utilities設定方式
tunctl -t tap0 -u #這裡填上你的使用者名稱
dhclient br0 #這是在br0用DHCP模式, #若要用固定實體主機IP: ifconfig br0 192.168.?.?
tunctl -t tap0 -u
brctl addbr br0
ifconfig eth0 0.0.0.0 promisc
brctl addif br0 eth0
dhclient br0
brctl addif br0 tap0
ifconfig tap0 up
chmod 666 /dev/net/tun上面可以寫成shell script 存檔,記得用 root 身份執行這些指令,完成後 ifconfig 會多 br0 , tap0 。
而在 VirtualBox 網路設定為 “Host Interface” 而 Interface Name 為 tap0。而 guest os 就可以互連 host os 。
若要關掉 bridge 模式
brctl delif br0 eth0
brctl delif br0 tap0
brctl delbr br0
ifconfig tap0 down
ifconfig br0 down
ifconfig eth0 down
ifconfig eth0 up不過 bridge 模式適合用在有線網卡,無線網卡部份還無法適用。
資料來源:
http://blog.3funs.com/index.php/2007/10 ... idge-mode/