All HowTo's Linux Ubuntu, Mint & Debian Linux

Using the “ip” command rather than “ifconfig” on Linux

Long-time Linux system administrators typically use the “ifconfig” command. Perhaps out of habbit, or because it works on other OS’s (similar to ipconfig on Windows). But we should be using the “ip” command in-place of “ifconfig”. The “net-tools” package needs to be installed if you want the “ifconfig” command, and other commands. If you’re working with IP address allocation, the “ip” command is the way to go.

Note that these commands don’t modify config files.

Show ip addresses and other details about an interface:

ifconfig eth0
ip addr show eth0

“Add” an IP address on eth0:

ifconfig eth0 netmask
ip addr add dev eth0

“Remove” (or delete) an IP address on eth0:

ip addr del dev eth0

Bring the interface (eth0) up:

ifconfig eth0 up
ip link set eth0 up

Or if you’re using DHCP:

# release the current DHCP lease for eth0:
dhclient -r eth0

# obtain a new lease for eth0:
dhclient eth0

Leave a Reply

Your email address will not be published. Required fields are marked *