Looking at the Network

The ip command

Everything about a Linux machine's network is shown and changed with one tool: ip. Its most useful view is ip addr (addresses on each interface). An interface is a network connection point: a physical card, a virtual device, or lo, the loopback that every machine has for talking to itself at 127.0.0.1:

ip addr show
ip -brief addr show

In the terminal

student@vulntech:~$ 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 noprefixroute
       valid_lft forever preferred_lft forever
2: enp0s5: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:22:15:29:19:14 brd ff:ff:ff:ff:ff:ff
student@vulntech:~$ ip -brief addr show
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp0s5           DOWN

-brief gives one tidy line per interface. This machine has only lo — later in the module you'll add more interfaces yourself.

Links and routes

ip link shows the interfaces themselves (their state and hardware addresses), and ip route shows the routing table: the rules that decide where a packet is sent based on its destination:

ip link show
ip route show

In the terminal

student@vulntech:~$ ip link show
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: enp0s5: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether 00:22:15:29:19:14 brd ff:ff:ff:ff:ff:ff
student@vulntech:~$ ip route show

Tip: ip replaces the older ifconfig and route commands you may see in guides. ip a, ip l and ip r are accepted short forms.

Remember: ip addr shows interfaces and their IP addresses, ip link the interfaces themselves, ip route the routing table. lo is the loopback interface (127.0.0.1).

HOME LEARN COMMUNITY DASHBOARD
Practice terminal Starting…