高级网络配置

来源:互联网 发布:万能五笔for mac版 编辑:程序博客网 时间:2024/05/22 08:01

1.添加临时的br0桥接模式
brctl addbr br0 ##添加br0端口
ifconfig br0 172.25.254.137 netmask 255.255.255.0 ##更改ip与子网掩码
brctl addif br0 eth0 ##连接到eth0这个网络端口

测试:
ping 172.25.254.250

删除:
ifconfig br0 down ##停止br0网络端口
brctl delif br0 eth0 ##删除与eth0的连接
brctl delbr br0 ##删除br0端口

2.网卡链路
环境:原有网卡eth0,添加网卡eth1

bond配置(最多2个网卡):
nmcli connection add type bond con-name bond0 ifname bond0 mode active-backup ip4 172.25.254.137/24 ##添加br0端口并设置ip
nmcli connection add con-name eth0 ifname eth0 type bond-slave master bond0 ##绑定eth0到bond0
nmcli connection add con-name eth1 ifname eth1 type bond-slave master bond0 ##绑定eth1到bond0

删除:
nmcli connection delete eth0 ##删除eth0端口
nmcli connection delete eth1 ##删除eth1端口
nmcli connection delete bond0 ##删除bond0端口

team配置(最多8个网卡):
team的模式:
broadcast(广播容错)roundrobin(轮询)activebackup(主备)loadbalance(负载均衡)

下面配置的是主备模式:
nmcli connection add type team con-name team0 ifname team0 config ‘{“runner”:{”name”:”activebackup”}}’ ip4 172.25.254.137/24 ##添加team0端口
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0 ##绑定eth0到team0
nmcli connection add con-name eth1 ifname eth1 type team-slave master team0 ##绑定eth1到team0
这里写图片描述
这里写图片描述
这种模式下服务会自动轮换网络端口,保证网络稳定性
删除:
nmcli connection delete eth0 ##删除eth0端口
nmcli connection delete eth1 ##删除eth1端口
nmcli connection delete team0 ##删除team0端口

原创粉丝点击