高级网络配置

本文详细介绍如何使用NetworkManager进行网络配置,包括创建和管理bonding、team及桥接连接。通过命令行操作,如nmcliconnectionadd和nmcliconnectiondelete,实现对网络接口的灵活控制,同时提供了具体的配置示例。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

必须存在两张真实网卡
systemctl status NetworkaManager    ##bond服务
nmcli connection show
nmcli connection delete "system eth0"
nmcli connection show


  watch cat /proc/net/bonding/bond0 做测试
nmcli connection add con-name bond0 ifname bond0 type bond mode active-backup ip4 172.25.254.129/24


 nmcli connection add con-name eth0 ifconame eth0 type bond-slave master bond0


 nmcli connection add con-name eth1 ifname eth0 type bond-slave master bond0


  ifconfig eth0 down


  ifconfig eth0 up
  ifconfig eth1 down


  ifconfig  eth1up
删除
  nmcli connection delete bond0/eht0/eth1
                 
nmcli connection add con-name team0 ifname team0 type team config  '{"runner":{"name":"activebackup"}}' ip4 172.25.254.129/24
nmcli connection add con-name eth0 ifname eth0 type team-slave master team0
nmcli connection add con-mame eth1 ifname eth1 type team-slave master team0


查看teamdctl team0 stat(分别关闭eth0和eth1查看效果)

 

 

删除nmcli connection delete team0/eth0/eth1
桥接
编辑vim ifcfg-name
BOOTPROTO=none
DEVICE=enp0s25
ONBOOT=yes
BRIDGE=br0


新建文件
vim ifcfg-br0
DEVICE=br0
BOOTPROTO=none
TYPE=Bridge
IPADDR=172.25.254.29
PREFIX=24
ONBOOT=yes


2.brctl addbr br0
ifconfig br0 172.25.254.129/24
brctl addif br0 eth0
brctl show
ping 172.25.254.29


删除
brctl delif br0 eth0
ifconfig br0 down
brctl delbr br0


        

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值