# 记住你的网卡名称 $ ip addr show # 类似如下,我的网卡是enp6s0 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo valid_lft forever preferred_lft forever inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000 link/ether 2a:03:3e:20:0a:00 brd ff:ff:ff:ff:ff:ff inet 192.168.0.99/24 brd 192.168.0.255 scope global dynamic noprefixroute enp6s0 valid_lft 40724sec preferred_lft 40724sec inet6 240e:388:8aff:5500::489/128 scope global dynamic noprefixroute valid_lft 1425sec preferred_lft 1425sec inet6 240e:388:8aff:5500:b65c:688b:f9ec:16b3/64 scope global temporary dynamic valid_lft 1426sec preferred_lft 1426sec inet6 240e:388:8aff:5500:2803:3eff:fe20:aa8/64 scope global dynamic mngtmpaddr noprefixroute valid_lft 1426sec preferred_lft 1426sec inet6 fe80::2803:3eff:fe20:aa8/64 scope link noprefixroute valid_lft forever preferred_lft forever
2.2 增加桥接网卡
创建一个名为kvmbr0的桥接网卡,注意修改如下你的网卡(enp6s0)和ip地址
1 2 3 4 5 6
# 查看现有链接 $ nmcli con show $ nmcli con add ifname kvmbr0 type bridge autoconnect yes con-name kvmbr0 $ nmcli con add type bridge-slave autoconnect yes ifname enp6s0 master kvmbr0 # 下线旧网卡,下线之后大约一分钟左右会上线,所以这个命令和后续的命令需要同时执行 $ nmcli con down enp6s0;nmcli connection up kvmbr0