Table of Contents

Manage Networking

Service configuration files are stored in the /etc/NetworkManager/system-connections/ directory.

nmcli

a staple for network management

Here are some nmcli command options and what they do

option function
nmcli dev status displays status of all network devices
con show display all connections use --active to show active ones or just a connection name for more details
dev disconnect disconnects the specified network device
con add con-name adds a network connection. need to specify a lot more stuff
connection modify to make changes to the config of a connection
con reload to reload a connection
con up name Activate the connection name
dev dis dev Disconnect the interface, which also deactivates the current connection

example of one is

nmcli con add con-name eno3 type ethernet ifname eno3 ipv4.method manual ipv4.addresses 192.168.0.5/24 ipv4.gateway 192.168.0.254
 nmcli con mod static-ens3 ipv4.addresses 192.0.2.2/24 ipv4.gateway 192.0.2.254 connection.autoconnect yes 

ip

to get details about the networking config of a device use

ip addr show dev eth0 

[user@host ~]$ ip addr show dev eth0
3: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:01:fa:0a brd ff:ff:ff:ff:ff:ff
    inet 10.42.0.1/16 brd 10.42.255.255 scope global noprefixroute eth0
       valid_lft forever preferred_lft forever
    inet6 fe80::7418:cf98:c742:3681/64 scope link noprefixroute
       valid_lft forever preferred_lft forever

TO just get the IP address use

 --br

here is for one device

[user@host ~]$ ip -br addr show dev eth0
eth0          UP          10.42.0.1/16 fe80::7418:cf98:c742:3681/64

and here it is for all nics

[u-ansible@dubrhsatserver62 plays]$ ip -br addr show
lo               UNKNOWN        127.0.0.1/8
ens192           UP             10.5.5.70/24
virbr0           DOWN           192.168.122.1/24

use -s option to show the statistic for interface

[student@servera ~]$ ip -s link show enX
2: enX: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:00:fa:0a brd ff:ff:ff:ff:ff:ff
    RX: bytes  packets  errors  dropped overrun mcast
    89014225   168251   0       154418  0       0
    TX: bytes  packets  errors  dropped carrier collsns
    608808     6090     0       0       0       0 

Network troubleshooting tools

command usage
mtr similar to tracepath but does notinuos checking
ss checkes the sockets best option to use with it is -plunt allows you to see ports opened per ip
nmap use option -sS gives you what ports are open
ip -s link show interace Displays statistics for the interface