Many modern distributions, like for example the upcoming Debian 12 Bookworm, do not install the package net-tools
by default. This package contains popular utilities like ifconfig
, route
, netstat
, arp
and mii-tool
. In this post I give alternatives for these utilities. You can of course just install the net-tools package if you prefer to keep using these commands.
ifconfig
To see the current network configuration:
$ ip addr
To see the currrent configuration for one specific interface, for example enp25s0
:
$ ip addr show enp25s0
To add a static IP address to a network interface
$ ip addr add 192.168.10.2/24 dev enp25s0
Replace add
by del
to remove an IP address.
route
To see the current route table:
$ ip route
To set the default gateway:
$ ip route add default via 192.168.10.1 dev enp25s0
netstat
The ss
command lists all open sockets. Some interesting options:
-a | show both open and listening sockets |
-l | only show listening sockets |
-p | shows the process using the socket |
-t | show only TCP sockets |
-u | show only UDP sockets |
-r | resolve all IP addresses |
To see all open and listening sockets on the system:
$ ss -a
To see all listening TPC and UDP ports:
$ ss -plut
arp
Display the contents of the ARP table:
$ ip neigh
mii-tool
Show the status of an Ethernet interface:
$ ethtool enp25s0