Linux Network

Linux Network

# nmcli connection show
# nmcli conn show
# nmcli c s
# nmcli dev status
# ip link
# ip l
# ip addr
# ip a
# ip -4 a

Creating the Network Bonding using nmcli
https://www.thegeekdiary.com/centos-rhel-7-how-to-create-an-interface-bonding-nic-teaming-using-nmcli/
https://www.thegeekdiary.com/red-hat-centos-how-to-create-interface-bonding/

# nmcli connection
NAME UUID TYPE DEVICE
ens33 59b61d18-90ed-4c3c-97e0-6c9e0528f25f 802-3-ethernet ens33
ens37 c09f18e1-793b-4d60-9107-98762cf593a7 802-3-ethernet ens37

# nmcli con add type bond con-name bond0 ifname bond0 mode active-backup ip4 192.168.10.212/24
# nmcli con add type bond con-name bond0 ifname bond0 mode 6 ip4 192.168.10.212/24
Connection ‘bond0’ (1a75eef0-f2c9-417d-81a0-fabab4a1531c) successfully added.

# nmcli connection
NAME UUID TYPE DEVICE
bond0 1a75eef0-f2c9-417d-81a0-fabab4a1531c bond bond0
ens33 59b61d18-90ed-4c3c-97e0-6c9e0528f25f 802-3-ethernet ens33
ens37 c09f18e1-793b-4d60-9107-98762cf593a7 802-3-ethernet ens37

# cat /etc/sysconfig/network-scripts/ifcfg-bond0
DEVICE=bond0
BONDING_OPTS=mode=active-backup
TYPE=Bond
BONDING_MASTER=yes
BOOTPROTO=none
IPADDR=192.168.219.150
PREFIX=24
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=bond0
UUID=1a75eef0-f2c9-417d-81a0-fabab4a1531c
ONBOOT=yes

# ip addr show bond0
5: bond0: [BROADCAST,MULTICAST,MASTER,UP] mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
inet 192.168.219.150/24 brd 192.168.219.255 scope global bond0
valid_lft forever preferred_lft forever

# nmcli con add type bond-slave ifname ens33 master bond0
Connection ‘bond-slave-ens33’ (79c40960-6b2c-47ba-a417-988332affed1) successfully added.

# nmcli con add type bond-slave ifname ens37 master bond0
Connection ‘bond-slave-ens37’ (46222a52-f2ae-4732-bf06-ef760aea0d7b) successfully added.

# nmcli connection
NAME UUID TYPE DEVICE
bond0 1a75eef0-f2c9-417d-81a0-fabab4a1531c bond bond0
ens33 59b61d18-90ed-4c3c-97e0-6c9e0528f25f 802-3-ethernet ens33
ens37 c09f18e1-793b-4d60-9107-98762cf593a7 802-3-ethernet ens37
bond-slave-ens33 79c40960-6b2c-47ba-a417-988332affed1 802-3-ethernet —
bond-slave-ens37 46222a52-f2ae-4732-bf06-ef760aea0d7b 802-3-ethernet —

# cat /etc/sysconfig/network-scripts/ifcfg-bond-slave-ens33
TYPE=Ethernet
NAME=bond-slave-ens33
UUID=79c40960-6b2c-47ba-a417-988332affed1
DEVICE=ens33
ONBOOT=yes
MASTER=bond0
SLAVE=yes

# cat /etc/sysconfig/network-scripts/ifcfg-bond-slave-ens37
TYPE=Ethernet
NAME=bond-slave-ens37
UUID=46222a52-f2ae-4732-bf06-ef760aea0d7b
DEVICE=ens37
ONBOOT=yes
MASTER=bond0
SLAVE=yes

# nmcli connection up bond-slave-ens33
# nmcli connection up bond-slave-ens37

# nmcli con up bond0

# ip link
2: ens33: [BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP] mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:54:f7:20 brd ff:ff:ff:ff:ff:ff
3: ens37: [BROADCAST,MULTICAST,SLAVE,UP,LOWER_UP] mtu 1500 qdisc pfifo_fast master bond0 state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:54:f7:20 brd ff:ff:ff:ff:ff:ff
4: bond0: [BROADCAST,MULTICAST,MASTER,UP,LOWER_UP] mtu 1500 qdisc noqueue state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:54:f7:20 brd ff:ff:ff:ff:ff:ff

mod is a shortcut for modify.
# nmcli con mod em4 ipv4.addresses 192.168.10.221/24
# nmcli con mod em4 ipv4.gateway 192.168.10.193
# nmcli con mod em4 ipv4.method manual
# nmcli con up em4

—-works start—
nmcli con down em4

nmcli con mod em4 ipv4.addresses 192.168.10.210/24
nmcli con mod em4 ipv4.gateway 192.168.10.193
nmcli con mod em4 ipv4.method manual
nmcli con up em4

—change connection to 210

nmcli con down bond-slave-em2
nmcli con down bond-slave-em3
nmcli con down bond0

nmcli con mod bond0 ipv4.addresses 192.168.10.211/24
nmcli con mod bond0 ipv4.gateway 192.168.10.193
nmcli con mod bond0 ipv4.method manual

nmcli con up bond-slave-em2
nmcli con up bond-slave-em3
nmcli con up bond0
—————————–
—-works end—

Advertisements