centos7 鏈路聚合+KVM橋接連網

1、兩個物理網卡作鏈路聚合(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 yesserver

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 team0blog

4)設置虛擬接口網關
nmcli connection modify team0 ipv4.gateway "192.168.1.1"dns

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 team0ip

#查看虛擬接口狀態
teamdctl team0 state view虛擬機

#查看虛擬接口參數
teamnl team0 optionshash

#查看虛擬接口
teamnl team0 portsit


2、新建一個橋設備
[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

3、修改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

4、修改虛擬機 virsh # edit jumpserver 這樣虛擬機重啓起後會自動加入br1橋。

<source bridge='br0'/> 改成 <source bridge='br1'/>

5、經過brctl橋命令來完成如下工做,重啓後失效。要修配置文件纔不會(修改/etc/sysconfig/network-scripts下網卡)

[root@localhost network-scripts]# brctl show

 

 

重啓網絡服務

相關文章
相關標籤/搜索