ip's Examples

To list interfaces with detailed info

IP address

To list interfaces with detailed info

ip address

To list interfaces with brief network layer 

ip -brief address

To list interfaces with brief link layer

ip -brief link

To display the routing table

ip route

To show neighbors (ARP table)

ip neighbour

To make an interface up/down

ip link set interface up/down

To add/delete an ip address to an interface

ip addr add/del ip/mask dev interface

To add a default route

ip route add default via ip dev interface

displays all information about all network interfaces

ip a

only shows TCP/IP ipv4

ip -4 a

shows the TCP/IP ipv6

ip -6 a

Deletes thr assigned address from the given interface

Ip addr del 192.168.255

Up flag with interface name enables a network interface

Ip link set eth1 up

Down flag with interface name disables the network interface

Ip link set eth1 down

To know the routing table information of the system

Ip route show

Output Example:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 ...
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ...
    inet 192.168.1.10/24 brd 192.168.1.255 scope global eth0
 

Explanation:
Lists all network interfaces and their assigned IP addresses.

ip addr show
or
ip a

Explanation:
Displays IP address details for interface eth0.

ip addr show eth0

Explanation:
Lists only IPv4 addresses.

ip -4 addr show

Explanation:
Lists only IPv6 addresses.

ip -6 addr show

Output Example:

default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link
 

Explanation:
Displays routing table details, showing how network traffic is routed.

ip route show
or
ip r

Explanation:
Assigns the IP 192.168.1.100 to eth0 (temporary change).

sudo ip addr add 192.168.1.100/24 dev eth0

Explanation:
Removes the assigned IP address from eth0.

sudo ip addr del 192.168.1.100/24 dev eth0

Explanation:

  • up activates the network interface.
  • down disables the network interface.

sudo ip link set eth0 up
and 
sudo ip link set eth0 down

Explanation:

  • up activates the network interface.
  • down disables the network interface.

sudo ip link set eth0 up
and 
sudo ip link set eth0 down

Explanation:

  • up activates the network interface.
  • down disables the network interface.

sudo ip link set eth0 up
and 
sudo ip link set eth0 down

Explanation:
Sets 192.168.1.1 as the default gateway.

sudo ip route add default via 192.168.1.1

Explanation:
Removes all assigned IP addresses from eth0.

sudo ip addr flush dev eth0

DevOpsSchool
Typically replies within an hour

DevOpsSchool
Hi there 👋

How can I help you?
×
Chat with Us