要用到bridge-utils 库没有的安装下

apt-get update
apt-get install bridge-utils 

bridge 命令参考该链接
然后是在宿主机搭设网桥,其中br0 是新增网卡,与主机目前使用主网卡桥接eth0(这个可以ifconfig 查看)
brctl addbr br0
brctl addif br0 enp3s0
brctl stp br0 on
ifconfig enp3s0 0 up
ifconfig br0 up
dhclient br0
你搭设好之后在宿主机查看
方法二、

Cd  etc/network/interfaces.d/
Vi br0

内容如下:

auto br0
   iface br0 inet dhcp 
   bridge_ports eth0

#br0为新增虚拟网卡,eth0为宿主机物理网卡(使用ifconfig 查询),配置完成可能不会生效对有些系统,若未生效reboot

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐