● 常用命令
查看网卡状态 | nmcli c show |
启动网卡 | *nmcli c up <ifname/UUID> * |
关闭网卡 | *nmcli c down <ifname/UUID> * |
删除网卡 | nmcli c delete <ifname/UUID> |
修改网卡 | nmcli c modify bond2.208 mtu 9000 nmcli c up bond2.208 |
将接口加入 bond | nmcli c add con-name enp59s0f0 type bond-slave ifname enp59s0f0 master bond1 mtu 1500 nmcli c add con-name enp175s0f0 type bond-slave ifname enp175s0f0 master bond1 mtu 1500 |
添加bond1 ,mode1 | nmcli c add type bond con-name bond1 ifname bond1 bond.options “mode=active-backup,miimon=100” ipv6.method “ignore” ipv4.method “disabled” mtu 1500 |
添加bond1 ,mode4 | nmcli c add type bond con-name bond1 ifname bond1 bond.options “ mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer3+4 “ ipv6.method “ignore” ipv4.method “disabled” mtu 1500 |
添加vlan 子接口 | nmcli c add type vlan con-name bond1. 2000 ifname bond1. 2000 vlan.parent bond1 vlan.id 2000 ipv4.method manual ipv4.addresses ‘192.168.100.104/24’ ipv6.method “ignore” mtu 1500 |
● 完整举例
#举例1 |
nmcli c delete ens18 ens19 nmcli c add con-name ens18 type bond-slave ifname ens18 master bond1 mtu 1500 nmcli c add con-name ens19 type bond-slave ifname ens19 master bond1 mtu 1500 nmcli c add type bond con-name bond1 ifname bond1 bond.options “mode=802.3ad,miimon=100,lacp_rate=fast,xmit_hash_policy=layer3+4” ipv6.method “ignore” ipv4.method “disabled” mtu 1500 nmcli c add type vlan con-name bond1.2000 ifname bond1.2000 vlan.parent bond1 vlan.id 2000 ipv4.method manual ipv4.addresses ‘192.168.102.100/24’ ipv6.method “ignore” mtu 1500 nmcli c reload |
#举例2 超融合 |
nmcli c delete bond1 enp59s0f0 enp60s0f0 nmcli c add con-name enp59s0f0 type bond-slave ifname enp59s0f0 master bond1 mtu 1500 nmcli c add con-name enp60s0f0 type bond-slave ifname enp60s0f0 master bond1 mtu 1500 nmcli c add type bond con-name bond1 ifname bond1 bond.options “mode=1,miimon=100” ipv6.method “ignore” ipv4.method “disabled” mtu 1500 nmcli c delete bond1.353 nmcli c add type vlan con-name bond1.353 ifname bond1.353 vlan.parent bond1 vlan.id 353 ipv4.method manual ipv4.addresses “${ip5}/21” ipv6.method “ignore” mtu 1500 nmcli c delete bond2 enp59s0f1 enp175s0f0 nmcli c add con-name enp59s0f1 type bond-slave ifname enp59s0f1 master bond2 mtu 1500 nmcli c add con-name enp175s0f0 type bond-slave ifname enp175s0f0 master bond2 mtu 1500 nmcli c add type bond con-name bond2 ifname bond2 bond.options “mode=1,miimon=100” ipv6.method “ignore” ipv4.method “disabled” mtu 1500 nmcli c delete bond2.351 nmcli c add type vlan con-name bond2.351 ifname bond2.351 vlan.parent bond2 vlan.id 351 ipv4.method manual ipv4.addresses “${ip6}/21” ipv6.method “ignore” mtu 1500 nmcli c delete bond3 enp60s0f1 enp175s0f1 nmcli c add con-name enp60s0f1 type bond-slave ifname enp60s0f1 master bond3 mtu 1500 nmcli c add con-name enp175s0f1 type bond-slave ifname enp175s0f1 master bond3 mtu 1500 nmcli c add type bond con-name bond3 ifname bond3 bond.options “mode=1,miimon=100” ipv6.method “ignore” ipv4.method “disabled” mtu 1500 nmcli c delete bond3.352 nmcli c add type vlan con-name bond3.352 ifname bond3.352 vlan.parent bond3 vlan.id 352 ipv4.method manual ipv4.addresses “${ip7}/22” ipv6.method “ignore” mtu 1500 nmcli c reload |