ip Linux Command
Modern replacement for ifconfig. Shows and manipulates routing, devices, and tunnels.
What does ip do?
Modern replacement for ifconfig. Shows and manipulates routing, devices, and tunnels.
Syntax
ip [options] object commandPractical example
ip addr showQuestions about ip
How do I show all IP addresses?
Use `ip addr show` or `ip a` to display all network interfaces and their IP addresses. Use `ip -4 a` for IPv4 only.
How do I show the routing table?
Use `ip route show` or `ip r` to display the kernel routing table. This shows default gateway and network routes.
How do I show network interfaces?
Use `ip link show` or `ip l` to list all network interfaces with their state (up/down) and MAC addresses.
How do I assign an IP address with ip?
Use `sudo ip addr add 192.168.1.100/24 dev eth0` to add an IP address to an interface. Use `ip addr del` to remove it.
How do I bring an interface up or down?
Use `sudo ip link set eth0 up` to enable, or `sudo ip link set eth0 down` to disable a network interface.
How do I add a default gateway?
Use `sudo ip route add default via 192.168.1.1` to set the default gateway. Use `ip route del` to remove a route.
How do I show neighbor (ARP) table?
Use `ip neigh show` to display the ARP table (IP-to-MAC address mappings), replacing the old `arp` command.
How do I show interface statistics?
Use `ip -s link show` to display packet counts, errors, and other statistics for each network interface.
Related Networking Commands
ifconfigDisplays or configures network interface parameters (deprecated, use ip).
netstatDisplays network connections, routing tables, interface statistics, and more.
pingSends ICMP echo request packets to test network connectivity to a host.
ssModern replacement for netstat. Dumps socket statistics quickly.
nmapNetwork exploration tool and port scanner (basic usage).
curlTransfers data from or to a server using various protocols (HTTP, FTP, etc.).