ip is the modern Linux command for network configuration. It replaces ifconfig, route, and arp.
Synopsis
ip [OPTIONS] OBJECT COMMAND
Objects
| Object | Description |
|---|
addr | IP addresses |
link | Network interfaces |
route | Routing table |
neigh | ARP 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
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
Show link status
$ 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
| Option | Description |
|---|
-br | Brief output |
-c | Color output |
-4 | IPv4 only |
-6 | IPv6 only |
-s | Statistics |
ip vs ifconfig
| Task | ip | ifconfig |
|---|
| Show addresses | ip addr | ifconfig |
| Add address | ip addr add | ifconfig eth0 add |
| Show routes | ip route | route -n |
| Interface up | ip link set up | ifconfig 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
Tutorials