How-to

The ip Command on a Dedicated Machine

ip shows and changes addresses, interfaces and routes. On a remote machine with one public address, it is also a tool to use with care: a wrong change can cut your session.

How do I see my addresses quickly?

ip -br addr
# lo        UNKNOWN  127.0.0.1/8 ::1/128
# eno1      UP       203.0.113.25/31
# eno2      DOWN

The brief form fits one interface per line. Every machine here has two physical ports and one public IPv4 address on a /31, so you will typically see one port up with the address and the second port present but unused. The network is IPv4 only, so no global IPv6 address appears. Interface names such as eno1, enp65s0f0 or ens1f0 depend on the hardware; check yours before writing any configuration.

What does the /31 mean for routing?

A /31 holds exactly two addresses: yours and the gateway's. With 203.0.113.25/31, the gateway is 203.0.113.24. No broadcast or network address is wasted, which is why point-to-point links use it. The IPv4 on a /31 entry covers the details.

ip route
# default via 203.0.113.24 dev eno1 proto static
# 203.0.113.24/31 dev eno1 proto kernel scope link src 203.0.113.25
ip route get 1.1.1.1

ip route get shows which route, interface and source address the kernel would use for a destination, useful when you add tunnels or extra routes.

How do I check link speed and errors?

ip -s -h link show eno1
ethtool eno1 | grep -E 'Speed|Duplex|Link detected'

-s adds counters for bytes, packets, errors and drops; -h makes them readable. Rising error or drop counts point to a cabling or switch problem, worth a ticket with the numbers. ethtool confirms the negotiated speed: 1 Gbps on E1 and E2, 10 Gbps on S1 to S12, 25 Gbps on the rest.

Which other views are useful?

CommandShows
ip -br linkInterfaces, state and MAC addresses
ip neighARP table; the gateway's MAC should appear as REACHABLE or STALE
ip -d link show wg0Details for tunnels, bridges and VLANs
ip rulePolicy routing rules
ip -j -p addrJSON output for scripts
ip monitorLive stream of address and route changes

JSON output pairs well with jq: ip -j addr show eno1 | jq -r '.[0].addr_info[0].local' prints the address for a script.

How do I make changes without locking myself out?

Changes made with ip apply immediately and disappear at reboot. That is useful for testing, and dangerous on the interface carrying your SSH session. Without an out-of-band console in the offer, a wrong address or route on eno1 cuts you off until a panel reboot restores the saved configuration. Safe habits:

  • Never change the main address or default route by hand on a live session.
  • Test additions on other interfaces: a dummy interface, a WireGuard tunnel or a bridge for virtual machines.
  • Schedule an automatic undo before risky steps: systemd-run --on-active=3min systemctl reboot, then cancel it with systemctl stop on the transient unit once all is well.
ip link add dummy0 type dummy
ip addr add 10.99.0.1/24 dev dummy0
ip link set dummy0 up
ip link del dummy0

Where is the permanent configuration?

It depends on the image. Ubuntu uses netplan files in /etc/netplan/, applied with netplan try, which rolls back automatically unless you confirm. Debian commonly uses /etc/network/interfaces or systemd-networkd. Rocky Linux, AlmaLinux and CentOS Stream use NetworkManager, managed with nmcli. FreeBSD uses /etc/rc.conf. Read the existing files before editing; they already hold the correct address and gateway from installation. Extra public addresses are not sold, so most changes involve private ranges for VPNs, containers or virtual machines, as in Virtualization hosts.

How do I find which process uses a port?

That is a socket question rather than an interface one; use The ss command. For path problems beyond your machine, see The ping command and tracepath vs traceroute.

Keep Reading

IPv4 on a /31

Why each machine gets one public IPv4 on a /31 network, how the two addresses split between gateway and server, and how to configure it.

Open

Port speed

What 1, 10 and 25 Gbps network ports mean in real transfer times, and which of our 68 machines carry each speed.

Open

The ss command

List sockets fast with ss: listening ports, filters by state, port and address, TCP internals like RTT, summaries and killing stuck sockets.

Open

Virtualization hosts

Carve one physical box into many virtual machines with Proxmox VE or KVM, guests behind NAT on a single public address.

Open

FAQ

Quick Answers

Run ip -br addr for a one-line-per-interface view.

The other address of the pair. With 203.0.113.25/31 the gateway is 203.0.113.24.

No. Make permanent changes in netplan, NetworkManager or the distribution's network files.

Run ip -s link show followed by the interface name and check the error and drop counters.

Extra public addresses are not sold, so only private ranges for tunnels, containers or VMs are useful.