Table of Contents

Network Management


1. Configuring a permanent static IP address

1.1. Using NetworkManager

1.1.1. Create a new profile "static" with a specified IP address, network prefix, default gateway and DNS:

# nmcli con add con-name static ifname eth0 type ethernet ipv4.method manual ipv4.address 192.168.124.80/24 ipv4.gateway 192.168.124.1 ipv4.dns 192.168.124.1
Connection 'static' (626088a2-710b-425f-91ef-209cf78bcc40) successfully added.


1.1.2. Activate the new "static" connection:

# nmcli con up static
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)


1.1.3. Verify the new active connection:

# nmcli con show --active
NAME    UUID                                  TYPE      DEVICE 
static  626088a2-710b-425f-91ef-209cf78bcc40  ethernet  eth0   


1.1.4. Verify the IP address:

# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:81:76:b3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.124.80/24 brd 192.168.124.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5444:48e4:604b:c5ca/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever


1.1.5. Verify the default gateway:

# ip route
default via 192.168.124.1 dev eth0 proto static metric 100 
192.168.124.0/24 dev eth0 proto kernel scope link src 192.168.124.80 metric 100 


1.1.6. Ping the DNS address:

# ping -c 3 192.168.124.1
PING 192.168.124.1 (192.168.124.1) 56(84) bytes of data.
64 bytes from 192.168.124.1: icmp_seq=1 ttl=64 time=0.179 ms
64 bytes from 192.168.124.1: icmp_seq=2 ttl=64 time=0.191 ms
64 bytes from 192.168.124.1: icmp_seq=3 ttl=64 time=0.178 ms

--- 192.168.124.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2000ms
rtt min/avg/max/mdev = 0.178/0.182/0.191/0.016 ms


1.2. Using network-scripts

1.2.1. Edit the network interface file to configure a static IP address:

# vi /etc/sysconfig/network-scripts/ifcfg-eth0
=>
TYPE=Ethernet
PROXY_METHOD=none
BROWSER_ONLY=no
BOOTPROTO=none
IPADDR=192.168.124.80
NETMASK=255.255.255.0
GATEWAY=192.168.124.1
DNS1=192.168.124.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
NAME=eth0
UUID=df7d88b6-a563-47bd-9805-a2824631610a
DEVICE=eth0
ONBOOT=yes


1.2.2. Reactivate the network interface:

# ifdown eth0; ifup eth0

or restart the network sertvice:

# systemctl restart network


1.2.3. Verify the IP address:

# ip addr show eth0
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 52:54:00:81:76:b3 brd ff:ff:ff:ff:ff:ff
    inet 192.168.124.80/24 brd 192.168.124.255 scope global eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::5054:ff:fe81:76b3/64 scope link 
       valid_lft forever preferred_lft forever


1.2.4. Verify the default gateway:

# ip route
default via 192.168.124.1 dev eth0 proto static metric 100 
192.168.124.0/24 dev eth0 proto kernel scope link src 192.168.124.80 metric 100


1.2.5. Ping the DNS address:

# ping -c 3 192.168.124.1
PING 192.168.124.1 (192.168.124.1) 56(84) bytes of data.
64 bytes from 192.168.124.1: icmp_seq=1 ttl=64 time=0.187 ms
64 bytes from 192.168.124.1: icmp_seq=2 ttl=64 time=0.170 ms
64 bytes from 192.168.124.1: icmp_seq=3 ttl=64 time=0.168 ms

--- 192.168.124.1 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1999ms
rtt min/avg/max/mdev = 0.168/0.175/0.187/0.008 ms

2. Configuring a permanent static route

2.1. Using NetworkManager

2.1.1. Add a static route to the "static" connection:

# nmcli con mod static +ipv4.routes "192.168.124.0/24 192.168.15.1"


2.1.2. Restart the network connection:

# nmcli con down static
Connection 'static' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
# nmcli con up static
Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/3)


2.1.3. Verify that the route is active:

# ip route
default via 192.168.124.1 dev eth0 proto static metric 100 
192.168.15.1 dev eth0 proto static scope link metric 100 
192.168.124.0/24 dev eth0 proto kernel scope link src 192.168.124.80 metric 100 
192.168.124.0/24 via 192.168.15.1 dev eth0 proto static metric 100 


2.2. Using network-scripts

2.2.1. Edit the network interface file to add a static route:

# vi /etc/sysconfig/network-scripts/route-eth0
=>
192.168.124.0/24 via 192.168.15.1 dev eth0


2.2.2. Reactivate the network interface:

# ifdown eth0; ifup eth0

or restart the network sertvice:

# systemctl restart network


2.2.3. Verify that the route is active:

# ip route
default via 192.168.124.1 dev eth0 proto static metric 100 
192.168.15.1 dev eth0 proto static scope link metric 100 
192.168.124.0/24 dev eth0 proto kernel scope link src 192.168.124.80 metric 100 
192.168.124.0/24 via 192.168.15.1 dev eth0 proto static metric 100 

3. Configuring a network bond interface

3.1. Create a bond interface with the "active-backup" mode:

# nmcli con add type bond con-name bond0 ifname bond0 bond.options "mode=active-backup"
Connection 'bond0' (004a73e8-a8ed-4720-be7e-b778a979d23c) successfully added.


3.2. Display the network interfaces:

# nmcli dev
DEVICE     TYPE      STATE             CONNECTION 
ens4f0np0  ethernet  disconnected      --    
ens5f0np0  ethernet  disconnected      -- 
lo         loopback  unmanaged         --         


3.3. Assign the network interfaces to the bond:

# nmcli con add type ethernet slave-type bond con-name bond0-port1 ifname ens4f0np0 master bond0
Connection 'bond0-port1' (93fc8898-fda8-4772-abec-6db347c21c9f) successfully added.
# nmcli con add type ethernet slave-type bond con-name bond0-port2 ifname ens5f0np0 master bond0
Connection 'bond0-port2' (0e44212c-5797-49e6-82ba-98b568100bc8) successfully added.


3.4. Configure the static IPv4 address, network mask, default gateway and DNS server:

# nmcli con mod bond0 ipv4.addresses 192.168.15.105/24 ipv4.gateway 192.168.15.1 ipv4.dns 192.168.15.1 ipv4.method manual


3.5. Activate the connection:

# nmcli con up bond0
Connection successfully activated (master waiting for slaves) (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/16)


3.6. Verify that the ports are connected:

# nmcli dev
DEVICE     TYPE      STATE             CONNECTION 
bond0      bond      connected         bond0
ens4f0np0  ethernet  connected         bond0-port1
ens5f0np0  ethernet  connected         bond0-port2
lo         loopback  unmanaged         --         


3.7. Display the connections:

# nmcli con
NAME    	UUID                                  TYPE      DEVICE 
bond0   	004a73e8-a8ed-4720-be7e-b778a979d23c  bond      bond0 
bond0-port1	93fc8898-fda8-4772-abec-6db347c21c9f  ethernet  ens4f0np0
bond0-port2	0e44212c-5797-49e6-82ba-98b568100bc8  ethernet  ens5f0np0


3.8. Enable all ports automatically when the bond is connected:

# nmcli con mod bond0 connection.autoconnect-slaves 1


3.9. Display the status of the bond:

# cat /proc/net/bonding/bond0
Ethernet Channel Bonding Driver: v3.7.1 (April 27, 2011)

Bonding mode: fault-tolerance (active-backup)
Primary Slave: None
Currently Active Slave: ens4f0np0
MII Staus: up
MII Polling Interval (ms): 100
Up Delay (ms): 0
Down Delay (ms): 0
Peer Notification Delay (ms): 0

Slave Interface: ens4f0np0
MII Staus: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 84:16:0c:11:33:f8
Slave queue ID: 0

Slave Interface: ens5f0np0
MII Staus: up
Speed: 10000 Mbps
Duplex: full
Link Failure Count: 0
Permanent HW addr: 84:16:0c:11:33:f9
Slave queue ID: 0