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 addr or ip a: all addresses with details
  • ip -br addr: short table; ip -4 -br addr or ip -6 addr for one IP version
  • ip addr show dev eth0: one interface
  • ip -br link and ip link show dev eth0: state, MAC address and MTU
  • ip -s link show dev eth0: RX and TX bytes, packets, errors and drops
  • ip -c -br addr: the same in colour
  • ip -j addr: JSON for scripts, for example ip -j -4 addr show dev eth0 | jq -r '.[].addr_info[].local' printed 192.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 label
  • sudo ip -6 addr add 2001:db8::10/64 dev eth0: add an IPv6 address
  • sudo ip addr del 192.0.2.11/24 dev eth0: remove one address
  • sudo 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 up or down
  • sudo ip link set dev eth0 mtu 9000
  • sudo ip link set dev eth0 promisc on (and off)
  • sudo ip link set dev eth0 address 52:54:00:12:34:56: change the MAC address
  • sudo 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 (or ip r), ip -6 route, ip route show default
  • sudo ip route add default via 192.0.2.1: set the default gateway
  • sudo ip route add 198.51.100.0/24 via 192.0.2.254: route a network through a gateway
  • sudo ip route add 203.0.113.0/24 dev eth0: a network reachable directly on the interface
  • sudo ip route replace 198.51.100.0/24 via 192.0.2.253: change a route, or add it if missing
  • sudo ip route del 198.51.100.0/24: delete a route
  • ip route get 198.51.100.7: which gateway, interface and source address a packet would use; add from 192.0.2.11 to test another source
  • ip 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 neigh or ip neigh show dev eth0: the ARP cache (IPv4) and IPv6 neighbours
  • sudo ip neigh add 192.0.2.1 lladdr 52:54:00:00:00:01 dev eth0: a static entry
  • sudo ip neigh replace 192.0.2.1 lladdr 52:54:00:00:00:02 dev eth0: change it
  • sudo ip neigh del 192.0.2.1 dev eth0 and sudo 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 interface
  • sudo ip maddr add 33:33:00:00:00:01 dev eth0 and sudo 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 (or ip -br addr)
  • ifconfig eth0 192.0.2.10 netmask 255.255.255.0: ip addr add 192.0.2.10/24 dev eth0
  • ifconfig eth0 up: ip link set dev eth0 up
  • route -n: ip route
  • route add default gw 192.0.2.1: ip route add default via 192.0.2.1
  • arp -n: ip neigh
  • netstat -i: ip -s link
  • netstat -g: ip maddr
  • netstat -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

Was this answer helpful? 0 Users Found This Useful (0 Votes)