Linux双网卡绑定

发布时间:2026/9/5 16:44:53
Linux双网卡绑定 RHEL7.6查看网卡信息 # nmcli device # nmcli connection show # nmcli connection delete ens192 # nmcli connection delete ens224 # nmcli connection show1、创建绑定网卡bond0 并设置IP地址#nmcli connection add type bond ifname bond0 con-name bond0 miimon 100 mode active-backup primary enp1s0f0 ipv4.method manual ipv4.addresses 10.0.100.183/24 ipv4.gateway 10.0.100.12、创建bond0的子接口# nmcli connection add type bond-slave ifname enp1s0f0 con-name bond0-enp1s0f0 master bond0# nmcli connection add type bond-slave ifname enp1s0f1 con-name bond0-en01s0f1 master bond03、查看并激活的网络接口# nmcli connection show --active # nmcli connection up bond0-enp1s0f0 # nmcli connection up bond0-enp1s0f1 # nmcli connection up bond0 # nmcli connection down enp1s0f0 # 给enp1s0f0和enp1s0f1改名debian121、安装netplan.io2、在/etc/netplan目录下编辑01-netplan-bond.yamlnetwork: version: 2 renderer: networkd ethernet: eth0: dhcp4: no eth1: dhcp4: no bonds: bond0: interfaces: - eth0 - eth1 parameters: mode: active-backup primary: eth0 mii-monitor-interval: 100 bridges: br0: interfaces: [bond0] dhcp4: no addresses: [192.168.1.10/24] gateway4: 192.168.1.1 nameservers: addresses: [8.8.8.8, 8.8.4.4]3、验证netplan generate 应用 netplan apply麒麟V10 Sp3nmcli connection add type bond con-name bond0 ifname bond0 bond.options modeactive-backup,miimon100nmcli connection modify bond0 ipv4.method manual ipv4.addresse 192.168.250.246 ipv4.gateway 192.168.250.1 ipv6.method ignorenmcli con add type bond-slave ifname em3 master bond0nmcli con add type bond-slave ifname em4 master bond0