IP Command Minimal Tutorial

December 17, 2018

ip command is used to show / manipulate routing, devices, policy routing and tunnels. Below are simple usage of ip command to viewing basic details.

Q: To see your packet routes from your machine ?
A: Use command : ip route list

Below are few different kind of lines, that you will see as output dev en0  scope link dev en0  scope link dev en0  scope link dev wlan0  proto kernel  scope link  src via dev utun2 via dev utun2 dev en0  scope link dev en0  scope link

What does it mean:

  • dev en0 scope link: Any packet with ip address within range with do via device en0. Scope means the area where this address is valid.

    Different scope values in route list

    Scope Description
    global valid everywhere
    site valid only within this site (IPv6)
    link valid only on this device
    host valid only inside this host (machine)
  • Similar is for 2 and 3rd line.

  • dev wlan0 proto kernel scope link src Any packet with ip range within, should go via device wlan0 with scope of link i.e. valid for this device only with as the source IP address, which in this case is the IP address assigned to wlan0 via DHCP.

  • via dev utun2: Any packet with ip range within should do via device utun2 with source address as

Q: How can we see all networking devices like en0, utun2, wlan0, eth0?
A: To see each interface: ip link show [ DEVICE ]. E.g ip link show utun2

Q: How can we see address for the networking device ?
A: Use command: Usage: ip addr show [ dev STRING ]. E.g. ip addr show dev utun2

To see all network interfaces: ip link show To view all network interfaces: ip addr show

Ref: http://linux-ip.net/html/tools-ip-address.html

Please give feedback at email@murarisumit.in