Linux 配置 VirtualBox 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







评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值