centos7 链路聚合+KVM桥接连网
一、两个物理网卡做链路聚合(em3,em4)
1)创建team类型的网卡,连接别名为team0,使用的模式为activebackup-主备/loadbalance-负载均衡
nmcli con add type team con-name team0 ifname team0 config '{"runner": {"name":"loadbalance"}}'
2)根据题目要求给team0网卡绑定指定的IP
nmcli con mod team0 ipv4.addresses '192.168.1.100/24' ipv4.method manual connection.autoconnect yes
3)给team0虚拟接口添加网卡
nmcli connection add type team-slave con-name team-port1 ifname em3 master team0
nmcli connection add type team-slave con-name team-port2 ifname em4 master team0
4)设置虚拟接口网关
nmcli connection modify team0 ipv4.gateway "192.168.1.1"
5)设置虚拟接口DNS
nmcli connection modify team0 ipv4.dns "192.168.1.216 8.8.8.8"
6)启动
nmcli connection up team0-port1
nmcli connection up team0-port2
nmcli connection up team0
#查看虚拟接口状态
teamdctl team0 state view
#查看虚拟接口参数
teamnl team0 options
#查看虚拟接口
teamnl team0 ports
二、新建一个桥设备
[root@localhost network-scripts]# cat ifcfg-br1
DEVICE=br1
TYPE=Bridge
BOOTPROTO=static
IPADDR=192.168.1.100
NETMASK=255.255.255.0
GATEWAY=192.168.1.1
DNS1=192.168.1.216
DNS2=202.96.128.86
ONBOOT=yes
三、修改team0聚合网卡 注释#IPADDR=192.168.1.100
[root@localhost network-scripts]# cat ifcfg-team0
TEAM_CONFIG="{\"runner\": {\"name\": \"loadbalance\", \"tx_hash\": [\"eth\", \"ipv4\", \"ipv6\"]}}"
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=team0
UUID=**********************************
DEVICE=team0
ONBOOT=yes
DEVICETYPE=Team
#IPADDR=192.168.1.100
PREFIX=24
四、修改虚拟机 virsh # edit jumpserver 这样虚拟机重启起后会自动加入br1桥。
<source bridge='br0'/> 改为 <source bridge='br1'/>
五、通过brctl桥命令来完成以下工作,重启后失效。要修配置文件才不会(修改/etc/sysconfig/network-scripts下网卡)
[root@localhost network-scripts]# brctl show
重启网络服务