-
2011-10-24
virtualbox 桥接 bridge 脚本 - [网络相关]
virtualbox 桥接模式需要 加载 vboxnetflt
modprobe vboxnetflt
需要 bridge-utils uml-utilities 两个包
pacman -S bridge-utils uml-utilities-----过程就是创建虚拟网卡tap0和桥接设置br0,把tap0和eth0 都加入 br0------
tunctl -t tap0 -u lnote #创建权限为lnote用户的tap0虚拟网卡
brctl addbr br0 #创建网桥
ifconfig eth0 0.0.0.0 promisc #混合模式 ?
brctl addif br0 eth0 #添加eth0到 br0网桥里
dhclient br0 #动态获取 ip地址 需要把eth0先加入到br0里才行
brctl addif br0 tap0 #添加 tap0 到br0 网桥里
ifconfig tap0 up #启动tap0
chmod 666 /dev/net/tun #设置 tun设备权限需要root用户执行上述命令 设置好了后 virtualbox 里面 网卡选择 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只适合有线网络 无线网卡好像不行







