IP

Netwerk Adapter informatie

Als je al wat langer met Linux werkt weet je dan je snel de gegevens van jouw netwerkverbinding kunt raadplegen door ifconfig of iwconfig te gebruiken. Maar deze tools worden al verouderd (Depricated) beschouwd en Distro’s zoal’s Debian hebben dit niet meer “standaard” geïnstalleerd. Een alternatief is ip.

De simpelste methode om deze gegevens weer te geven is $ ip a : (de a optie laat alles weergeven)

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: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether c8:69:cd:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.3/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan0
       valid_lft 2767sec preferred_lft 2767sec
    inet6 2a02:a03f:4c56:bf00:bfc2:0000:0000:0000/64 scope global dynamic noprefixroute 
       valid_lft 221981sec preferred_lft 221981sec
    inet6 fe80::a1e0:0000:0000:0000/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether f8:d1:11:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.4/24 brd 192.168.1.255 scope global dynamic noprefixroute wlan1
       valid_lft 2766sec preferred_lft 2766sec
    inet6 2a02:a03f:4c56:bf00:78ed:0000:0000:0000/64 scope global dynamic noprefixroute 
       valid_lft 221981sec preferred_lft 221981sec
    inet6 fe80::8cc:0000:0000:0000/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
            

Laten we dit eens vergelijken met de “oude” methodes, $ ifconfig

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 10080  bytes 853274 (833.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 10080  bytes 853274 (833.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.3  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::a1e0:0000:0000:0000  prefixlen 64  scopeid 0x20<link>
        inet6 2a02:a03f:4c56:bf00:bfc2:0000:0000:0000  prefixlen 64  scopeid 0x0<global>
        ether c8:69:cd:00:00:00  txqueuelen 1000  (Ethernet)
        RX packets 285  bytes 37756 (36.8 KiB)
        RX errors 0  dropped 0  overruns 0  frame 37377
        TX packets 156  bytes 17663 (17.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 18  

wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.4  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 2a02:a03f:4c56:bf00:78ed:0000:0000:0000  prefixlen 64  scopeid 0x0<lobal>
        inet6 fe80::8cc:0000:0000:0000  prefixlen 64  scopeid 0x20<link>
        ether f8:d1:00:00:00:  txqueuelen 1000  (Ethernet)
        RX packets 47960  bytes 30173795 (28.7 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 46731  bytes 26380995 (25.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                
            

en iwconfig: $ iwconfig :

wlan1     IEEE 802.11  ESSID:"Linuxgebruikers"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: 30:D3:2D:00:00:00   
          Bit Rate=58.5 Mb/s   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=45/70  Signal level=-65 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:389   Missed beacon:0

lo        no wireless extensions.

wlan0     IEEE 802.11  ESSID:"Debian"  
          Mode:Managed  Frequency:2.412 GHz  Access Point: C0:4A:00:00:00:00   
          Bit Rate:13 Mb/s   Tx-Power=200 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=32/70  Signal level=-78 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0                
            

ip heeft natuurlijk nog vele andere opties, hier geef ik enkele voorbeelden.

$ ip route

default via 192.168.1.1 dev wlan1 proto dhcp metric 600 
default via 192.168.1.1 dev wlan0 proto dhcp metric 601 
192.168.1.0/24 dev wlan1 proto kernel scope link src 192.168.1.4 metric 600 
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.3 metric 601                
            

$ ip link

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
    link/ether c8:69:cd:00:00:00 brd ff:ff:ff:ff:ff:ff
3: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether f8:d1:11:00:00:00 brd ff:ff:ff:ff:ff:ff                
            

$ ip -d link (-d geeft meer gedetailleerde gegevens)

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 promiscuity 1 addrgenmode eui64 numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DORMANT group default qlen 1000
    link/ether c8:69:cd:00:00:00 brd ff:ff:ff:ff:ff:ff promiscuity 1 addrgenmode none numtxqueues 1 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535 
3: wlan1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether f8:d1:11:00:00:00 brd ff:ff:ff:ff:ff:ff promiscuity 1 addrgenmode none numtxqueues 4 numrxqueues 1 gso_max_size 65536 gso_max_segs 65535   
            

$ ip -d tcpmetrics

                10.0.0.25 age 1047.376sec cwnd 10 rtt 15515us rttvar 15515us source 192.168.1.4
10.0.0.26 age 855.224sec cwnd 10 rtt 24616us rttvar 24616us source 192.168.1.4
10.0.0.27 age 2827.896sec cwnd 10 rtt 165450us rttvar 165450us source 192.168.1.4
10.0.2.25 age 745.288sec cwnd 10 rtt 26043us rttvar 26043us source 192.168.1.4
10.0.0.28 age 2894.044sec source 192.168.1.4
10.0.0.29 age 2892.000sec source 192.168.1.4
0000:cb00:0000:0000::1111:0000 age 957.096sec cwnd 10 rtt 16337us rttvar 16337us source 1111:cb00:0000:0000::1111:0000
0000:cb00:0000:0000::1111:0011 age 692.284sec cwnd 10 rtt 29744us rttvar 29744us source 1111:cb00:0000:0000::1111:2121
10.0.030 age 2533.116sec cwnd 10 rtt 181705us rttvar 140865us source 192.168.1.4
0000:cb00:0000:0000::1111:4343 age 865.016sec cwnd 10 rtt 92577us rttvar 37560us source 0000:cb00:0000:0000::1111:0000
10.0.0.53 age 2558.880sec cwnd 10 rtt 20788us rttvar 20788us source 192.168.1.4
            

IP heeft nog vele andere mogelijkheden, voor een volledige lijst kun je zoals altijd de manpages of infopages raadplegen of gewoon ip –help

Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { link | address | addrlabel | route | rule | neigh | ntable |
                   tunnel | tuntap | maddress | mroute | mrule | monitor | xfrm |
                   netns | l2tp | fou | macsec | tcp_metrics | token | netconf | ila |
                   vrf | sr }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec |
                    -f[amily] { inet | inet6 | ipx | dnet | mpls | bridge | link } |
                    -4 | -6 | -I | -D | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -a[ll] | -c[olor]}                
            

Meer informatie kun je altijd terugvinden in de manpages of de infopages