Updated: 9 October 2026 · Applies to: iproute2 6.15.0 (Debian 13, where every example was run), 6.19.0 (Ubuntu 26.04), 6.1.0 (Ubuntu 24.04) and 6.17.0 (AlmaLinux 10.2 and Rocky Linux 9.8)
The ip command from iproute2 shows and changes IP addresses, network interfaces, routes and the ARP (neighbour) table. It replaces the old ifconfig, route and arp commands. The ones you need most:
ip -br addr # every interface and its addresses, one line each ip addr show dev eth0 # full details for one interface ip route # routing table and default gateway ip neigh # ARP and IPv6 neighbour table ip -s link show dev eth0 # traffic and error counters
Object names can be shortened: ip a, ip r and ip n work too. Commands that change something need root (sudo), and every change is lost at the next reboot unless you also put it in your network configuration (see the end of this sheet).
Find your interface name first with ip -br link (often eth0, ens3 or enp1s0). The examples use eth0 with documentation addresses. Our test interface was one end of a virtual pair, which is why the output shows eth0@peer0; a normal network card shows just eth0.
Show addresses and interfaces
ip addrorip a: all addresses with detailsip -br addr: short table;ip -4 -br addrorip -6 addrfor one IP versionip addr show dev eth0: one interfaceip -br linkandip link show dev eth0: state, MAC address and MTUip -s link show dev eth0: RX and TX bytes, packets, errors and dropsip -c -br addr: the same in colourip -j addr: JSON for scripts, for exampleip -j -4 addr show dev eth0 | jq -r '.[].addr_info[].local'printed192.0.2.10
$ ip -br addr
lo UNKNOWN 127.0.0.1/8 ::1/128
peer0@eth0 UP fe80::5054:ff:feab:cdef/64
eth0@peer0 UP 192.0.2.10/24 192.0.2.11/24 2001:db8::10/64 fe80::5054:ff:fe12:3456/64
$ ip addr show dev eth0
6: eth0@peer0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
inet 192.0.2.10/24 scope global eth0
valid_lft forever preferred_lft forever
inet 192.0.2.11/24 scope global secondary eth0
valid_lft forever preferred_lft forever
inet6 2001:db8::10/64 scope global
valid_lft forever preferred_lft forever
inet6 fe80::5054:ff:fe12:3456/64 scope link
valid_lft forever preferred_lft forever
The second IPv4 address in the same subnet is marked secondary.
Add and remove IP addresses
sudo ip addr add 192.0.2.11/24 dev eth0: add an address (always give the prefix length)sudo ip addr add 192.0.2.12/24 dev eth0 label eth0:1: add it with an old-style alias labelsudo ip -6 addr add 2001:db8::10/64 dev eth0: add an IPv6 addresssudo ip addr del 192.0.2.11/24 dev eth0: remove one addresssudo ip addr flush dev eth0: remove all addresses and their routes from the interface
Adding an address twice gives Error: ipv4: Address already assigned. To check extra IPs on a server, see how to test that every additional IP address works.
Interface up, down, MTU, MAC and promiscuous mode
sudo ip link set dev eth0 upordownsudo ip link set dev eth0 mtu 9000sudo ip link set dev eth0 promisc on(andoff)sudo ip link set dev eth0 address 52:54:00:12:34:56: change the MAC addresssudo ip link set dev eth0 name lan0: rename (take the interface down first)
$ ip link show dev eth0
6: eth0@peer0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 9000 qdisc noqueue state UP mode DEFAULT group default qlen 1000
link/ether 52:54:00:12:34:56 brd ff:ff:ff:ff:ff:ff
Careful over SSH: taking an interface down also deletes the routes through it. In our test the default route was gone after down and did not come back with up; only the address and its subnet route returned. Never do this on the interface you are connected through unless you have console access.
Routes and the default gateway
ip route(orip r),ip -6 route,ip route show defaultsudo ip route add default via 192.0.2.1: set the default gatewaysudo ip route add 198.51.100.0/24 via 192.0.2.254: route a network through a gatewaysudo ip route add 203.0.113.0/24 dev eth0: a network reachable directly on the interfacesudo ip route replace 198.51.100.0/24 via 192.0.2.253: change a route, or add it if missingsudo ip route del 198.51.100.0/24: delete a routeip route get 198.51.100.7: which gateway, interface and source address a packet would use; addfrom 192.0.2.11to test another sourceip rule: policy routing rules
$ ip route
default via 192.0.2.1 dev eth0
192.0.2.0/24 dev eth0 proto kernel scope link src 192.0.2.10
$ ip route get 198.51.100.7
198.51.100.7 via 192.0.2.1 dev eth0 src 192.0.2.10 uid 0
cache
Two errors you will meet: RTNETLINK answers: File exists (the route is already there, use replace) and Error: Nexthop has invalid gateway. (the gateway is not in any subnet the server is connected to).
ARP and neighbour table
ip neighorip neigh show dev eth0: the ARP cache (IPv4) and IPv6 neighbourssudo ip neigh add 192.0.2.1 lladdr 52:54:00:00:00:01 dev eth0: a static entrysudo ip neigh replace 192.0.2.1 lladdr 52:54:00:00:00:02 dev eth0: change itsudo ip neigh del 192.0.2.1 dev eth0andsudo ip neigh flush dev eth0: remove one or all entries
$ ip neigh show dev eth0 192.0.2.1 lladdr 52:54:00:00:00:02 PERMANENT
Static entries show PERMANENT; learned ones show states such as REACHABLE or STALE.
Multicast addresses
ip maddr show dev eth0: multicast groups on an interfacesudo ip maddr add 33:33:00:00:00:01 dev eth0andsudo ip maddr del 33:33:00:00:00:01 dev eth0: add or remove a static link-layer multicast address
Old commands and their ip equivalents
ifconfig:ip addr(orip -br addr)ifconfig eth0 192.0.2.10 netmask 255.255.255.0:ip addr add 192.0.2.10/24 dev eth0ifconfig eth0 up:ip link set dev eth0 uproute -n:ip routeroute add default gw 192.0.2.1:ip route add default via 192.0.2.1arp -n:ip neighnetstat -i:ip -s linknetstat -g:ip maddrnetstat -tulpn:ss -tulpn(ss ships in the same iproute2 package)
More on the differences in ifconfig vs ip.
Make changes permanent
Put addresses and routes in the system's network configuration so they survive a reboot: Netplan on Ubuntu (static IP with Netplan), ifupdown on Debian (static IP on Debian 13) and NetworkManager (nmcli) on AlmaLinux, Rocky Linux and RHEL (static IP on RHEL-based systems).
Official documentation: ip(8), ip-route(8) and ip-neighbour(8).
Ucartz services for this topic
- KVM VPS hosting: NVMe SSD and full root access, with Free Basic Managed Support.
- Unmanaged dedicated servers: full root access and free IPMI KVM, with Free Basic Managed Support.
- Linux server management: hardening, patching, monitoring and automation for Ubuntu, Debian, RHEL and AlmaLinux.
