先装两个套件
用root 身份执行下面代码,或者编写到 Shell脚本里执行
VirtualBox 设置 Details -> Network -> Host Interface 在Interface Name 下面输入 tap0
关掉 bridge 模式设置
sudo apt-get install bridge-utils uml-utilities |
用root 身份执行下面代码,或者编写到 Shell脚本里执行
sudo tunctl -t tap0 -u enchanter #建立一个tap设备, 名字为tap0, 所有者为enchanter sudo ifconfig eth0 0.0.0.0 promisc #使eth0进入promiscuous模式 sudo ifconfig tap0 0.0.0.0 promisc #使tap0进入promiscuous模式 sudo brctl addbr br0 #增加一个网桥 sudo brctl addif br0 eth0 #将eth0加入网桥 sudo brctl addif br0 tap0 #将tap0加入网桥 sudo dhclient br0 #为br0设置IP地址 sudo ifconfig eth0 up #激活eth0 sudo ifconfig tap0 up #激活tap0 sudo chmod 0666 /dev/net/tun #设置访问权限 |
VirtualBox 设置 Details -> Network -> Host Interface 在Interface Name 下面输入 tap0
关掉 bridge 模式设置
brctl delif br0 eth0 brctl delif br0 tap0 brctl delbr br0 ifconfig tap0 down ifconfig br0 down ifconfig eth0 down ifconfig eth0 up |