ip – show and manipulate network interfaces and routing

ip command
ip command

ip is the modern Linux command for network configuration. It replaces ifconfig, route, and arp.

Synopsis

ip [OPTIONS] OBJECT COMMAND

Objects

ObjectDescription
addrIP addresses
linkNetwork interfaces
routeRouting table
neighARP cache

Examples

Show IP addresses

$ ip addr
$ ip a        # Short form

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

Show specific interface

$ ip addr show eth0

Show interfaces (brief)

$ ip -br addr
lo               UNKNOWN        127.0.0.1/8
eth0             UP             192.168.1.100/24

Show routing table

$ ip route
$ ip r

default via 192.168.1.1 dev eth0
192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.100
$ ip link
$ ip -br link

lo               UNKNOWN        00:00:00:00:00:00
eth0             UP             52:54:00:12:34:56

Show ARP cache

$ ip neigh
192.168.1.1 dev eth0 lladdr 00:11:22:33:44:55 REACHABLE

Configuration Commands (require root)

Add IP address

$ sudo ip addr add 192.168.1.101/24 dev eth0

Remove IP address

$ sudo ip addr del 192.168.1.101/24 dev eth0

Bring interface up/down

$ sudo ip link set eth0 up
$ sudo ip link set eth0 down

Add route

$ sudo ip route add 10.0.0.0/8 via 192.168.1.1

Delete route

$ sudo ip route del 10.0.0.0/8

Add default gateway

$ sudo ip route add default via 192.168.1.1

Useful Options

OptionDescription
-brBrief output
-cColor output
-4IPv4 only
-6IPv6 only
-sStatistics

ip vs ifconfig

Taskipifconfig
Show addressesip addrifconfig
Add addressip addr addifconfig eth0 add
Show routesip routeroute -n
Interface upip link set upifconfig eth0 up

Tips

  • Use ip, not ifconfig: ifconfig is deprecated
  • Changes are temporary: Use netplan/NetworkManager for permanent config
  • Color output: alias ip='ip -c' makes output more readable

See Also

  • ifconfig — Legacy interface config
  • netstat — Network statistics
  • ss — Socket statistics

Tutorials