nmcli—Configure static IP, team network card binding, and bridging

1. Configuration of static IP

网卡配置信息:/etc/sysconfig/network-scripts/

Insert image description here

Modify the static IP (taking the network card ens160 and the network segment 192.168.10.128 as an example. Based on NAT, it can only be changed to the static IP of the same network segment (192.168.10.100/24))

nmcli connection modify ens160 ipv4.addresses 192.168.10.100/24 ipv4.gateway 192.168.10.2 ipv4.dns 114.114.114.114 +ipv4.dns 8.8.8.8 ipv4.method manual connection.autoconnect yes

Insert image description here

2. Team network card binding

1.The role of team network card binding

team是基于逻辑化的模块管理,将多个物理网卡虚拟成一个逻辑接口。这样可以防止某块网卡出现故障而无法通信的问题出现。将多个网卡聚合在一起,从而实现冗错

2. Placement step :

(1) Multiple network cards 2^n (the default is up to ten under the virtual machine)

Insert image description here

(2) Ensure that each network card can achieve network communication based on the host (same network mode)

 nmcli device connect ens256
 nmcli device connect ens224

Insert image description here
Insert image description here

Team network group mode:

 broadcast:每个网卡都传送数据包
 roundrobin:每个网卡轮询方式传送数据
 activebackup:网卡之间有主备,主传送数据包,备的不传送,主网卡down掉,备才传送
 loadbalance:监控流量并使用哈希函数,使得每个网卡传送的数据包达到相等
 lacp:需要借助交换机,实现高级的负载均衡

Insert image description here

Insert image description here

(3) Add virtual team device (main)

 nmcli connection add type team ifname team0 con-name team0 config '{"runner":{"name": "activebackup"}}'

Insert image description here

(4) Add virtual team device (from)

 nmcli connection add type team-slave ifname ens224 con-name team0-port1 master team0
 nmcli connection add type team-slave ifname ens256 con-name team0-port2 master team0

Insert image description here

(5) Activate the team device (activate the slave first, then activate the master)

 nmcli connection up team0-port1
 nmcli connection up team0-port2
 nmcli connection up team0

Insert image description here

Insert image description here

(6) Test network card binding

teamdctl team0 stat

(7) Delete team0

nmcli connection delete team0-port1
nmcli connection delete team0-port2
nmcli connection delete team0

3. Bridging

  nmcli connection add type bridge ifname br1 con-name br1
  nmcli connection add type bridge-slave ifname ens160 con-name br1-port1 master br1
  nmcli connection up br1-port1
  nmcli connection up br1

Insert image description here

Guess you like

Origin blog.csdn.net/FlightDiarys/article/details/131842079