通过nmcli命令配置网络

CentOS 8.2/OpenEuler 21.10 配置备忘

nmcli con add type bond ifname bond0 bond.options "miimon=100,mode=1" ipv6.method disabled ipv4.method disabled
nmcli con add type ethernet ifname enp125s0f0 master bond0
nmcli con add type ethernet ifname enp125s0f1 master bond0
nmcli con add type vlan con-name bond0.1208 dev bond0 id 1208 ipv4.method manual connection.autoconnect yes ipv4.addresses 1xx.xxx.xx.xx/24

nmcli con add type bond ifname bond2 bond.options "miimon=100,mode=4,xmit_hash_policy=layer3+4" ipv6.method disabled ipv4.method disabled
nmcli con add type ethernet ifname enp189s0f0 master bond2
nmcli con add type ethernet ifname enp189s0f1 master bond2
nmcli con add type vlan con-name bond1.1808 dev bond1 id 1808 ipv4.method manual connection.autoconnect yes ipv4.addresses 1xx.xx.xx.3/24 ipv4.gateway 1xx.xx.xx.254

nmcli con add type vlan con-name bond1.1840 dev bond1 id 1840 ipv4.method manual connection.autoconnect yes ipv4.addresses 1xx.xx.xx.xx/24
nmcli connection modify bond0.1208 +ipv4.routes "192.168.0.0/16 100.71.8.254"
nmcli c reload && nmcli networking off && nmcli networking on