Network Configuration

General

ping -c4
ss -tul All UDP and TCP port listening
systemctl status NetworkManager
hostnamectl status
hostname set-hostname <newname>
/etc/hostname
/etc/hosts

iproute

List network cards

ip link list

List statistics network cards

ip -s link

Display device attributes

ip address show

Just up device.

ip address show up

Live IP configuration (non persistent)

ip addr add 192.168.50.5/24 dev eth1
ip addr del 192.168.50.5/24 dev eth1

Route list.

ip route list
ip route show

Obtain route use for 1.2.3.4

ip route get to 1.2.3.4

Print cache.

ip route ls cache

Flush route cache.

ip route flush cache

List rules.

ip rule show

Drop routing form 192.168.44.0/24 on the principal table

ip rule add table main type prohibit from 192.168.44.0/24

In ip rule add, type posibilities.

blackhole - the rule prescribes to silently drop the packet.

unreachable - the rule prescribes to generate a ’Network is unreachable’ error.

prohibit - the rule prescribes to generate ’Communication is administratively prohibited’ error.

File witch contains name table list.

/etc/iproute2/rt_tables

Create a new table.

echo 200 table33 >> /etc/iproute2/rt_tables

Add default route on this table.

ip route add default via 192.168.33.1 dev eth0 table table33

Verify.

ip route show table table33

Add new rule for the packets from 192.168.33.0/24 routed on the new table created (table33)

ip rule add from 192.168.33.0/24 table table33

nmcli

systemctl status NetworkManager
nmcli
nmtui
nmcli con shown
mcli con show <devicename>
nmcli dev status
ncli dev show <devicename>
nmcli con down eth0 && nmcli con up eth0
man nmcli-examples
nmcli con reload