July 19, 2022

RHEL 9.0 Getting Basic Network Setting

$ ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UPP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 52:54:00:d2:30:c4 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.58/24 brd 192.168.122.255 scope global dynamic noprefixroute enp1s0
       valid_lft 3184sec preferred_lft 3184sec
    inet6 fe80::5054:ff:fed2:30c4/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
  • state UP - An active interface is UP.
  • link/ether 52:54:00:d2:30:c4 - The link/ether string specifies the hardware (MAC) address of the device.
  • inet 192.168.122.58/24 - The inet string shows an IPv4 address, its network prefix length, and scope.
$ ip -s link show enp1s0
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UPP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000
    link/ether 52:54:00:d2:30:c4 brd ff:ff:ff:ff:ff:ff
    RX:  bytes packets errors dropped  missed   mcast           
      33591874   26436      0   17583       0       0 
    TX:  bytes packets errors dropped carrier collsns           
       1399002    7811      0       0       0       0 

If the destination network does not match a more specific entry, then the packet will be routed using 0.0.0.0/0 default entry. This default route points to the gateway router on a local subnet that the host can reach.

$ ip route show
default via 192.168.122.1 dev enp1s0 proto dhcp metric 100 
192.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.58 metric 100 

A more complex example.

$ ip route show
default via 192.168.1.1 dev wlp2s0 proto dhcp metric 600 
192.168.1.0/24 dev wlp2s0 proto kernel scope link src 192.168.1.142 metric 600 
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1 linkdown 
192.168.130.0/24 dev crc proto kernel scope link src 192.168.130.1 linkdown 

Getting DNS configuration.

$ cat /etc/resolv.conf 
# Generated by NetworkManager
search 0-01.mkk.se
nameserver 192.168.122.1

No comments: