一、聚合网络
聚合网络team的类型:
1、activebackup;
2、loadbalence;
3、roundrobin;
二、配置聚合网络
三种方式:
1、命令行;
2、配置文件;
3、图形化界面;
1、命令行方式:
添加team0
[[email protected] ~]# nmcli connection add con-name team0 type team ifname team0 config {"runner":{"name":"activebackup"}}
配置IP地址:
[[email protected] ~]# nmcli connection modify team0 ipv4.addresses "192.168.10.100/24" [[email protected] ~]# nmcli connection modify team0 ipv4.method manual
添加接口,在添加之前,确保添加的接口的连接已删除:
[[email protected] ~]# nmcli connection add con-name team0-port1 ifname ens34 type team-slave master team0
[[email protected] ~]# nmcli connection add con-name team0-port1 ifname ens38 type team-slave master team0
编辑ifcfg-team0配置文件,在这行加上单引号和双引号:
TEAM_CONFIG=‘{"runner":{"name":"activebackup"}}‘
重启网络服务:
[[email protected] network-scripts]# systemctl restart network
此时看到team0和绑定的2张网卡的Mac地址变为一致:
查看team0的工作状态:
[[email protected] ~]# teamdctl team0 state setup: runner: activebackup ports: ens38 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up ens34 link watches: link summary: up instance[link_watch_0]: name: ethtool link: up runner: active port: ens34
2、配置文件
1 DEVICE=team0 2 DEVICETYPE=Team 3 ONBOOT=yes 4 BOOTPROTO=none 5 IPADDR=192.168.10.100 6 NETWORK=255.255.255.0 7 TEAM_CONFIG=‘{"runner":{"name":"roundrobin"}}‘
1 DEVICE=ens34 2 DEVICETYPE=TeamPort 3 ONBOOT=yes 4 BOOTPROTO=none 5 TEAM_MASTER=team0
使用teamnl命令查看team的选项和端口:
[[email protected] network-scripts]# teamnl team0 ports 8: ens34: up 1000Mbit FD 4: ens38: up 1000Mbit FD
[[email protected] network-scripts]# teamnl team0 options queue_id (port:ens34) 0 priority (port:ens34) 0 user_linkup_enabled (port:ens34) false user_linkup (port:ens34) true enabled (port:ens34) true queue_id (port:ens38) 0 priority (port:ens38) 0 user_linkup_enabled (port:ens38) false user_linkup (port:ens38) true enabled (port:ens38) true mcast_rejoin_interval 0 mcast_rejoin_count 0 notify_peers_interval 0 notify_peers_count 0 mode roundrobin
[[email protected] network-scripts]# teamnl team0 getoption mode
3、图形化配置界面
打开nm-connection-editor,添加一个新连接:
三、配置桥接网络
1、使用brctl命令
查看桥接网络:
[[email protected] ~]# systemctl restart network [[email protected] ~]# brctl show bridge namebridge idSTP enabledinterfaces virbr08000.000000000000yes
添加桥接网络:
[[email protected] ~]# brctl addbr br0
添加接口:
[[email protected] ~]# brctl addif ens34 br0
2、使用nmcli命令
[[email protected] ~]# nmcli connection add con-name br1 type bridge ifname br1
[[email protected] ~]# nmcli connection modify br1 ipv4.addresses "192.168.20.20/24,192.168.20.1" [[email protected] ~]# nmcli connection modify br1 ipv4.method manual
[[email protected] ~]# nmcli connection add con-name br1-port1 type bridge-slave ifname ens34 master br1
时间: 2024-10-18 04:35:21