Net-tools to iproute2

From Leo's Notes
Revision as of 18:36, 11 March 2020 by Leo (talk | contribs)
This page was last edited on 11 March 2020, at 18:36.

The deprecated net-tools package contains all legacy network tools such as ipconfig, route, arp, etc. Since tools from net-tools are now obsolete, it is best practice to move towards using the replacement package iproute2.

The following table maps the old net-tools commands to the new iproute2 commands.

Old net-tools New iproute2
arp ip neighbour
netstat -ln ss -ln
netstat -r ip route
netstat -i ip -s link
ip maddr netstat -g
iwconfig iw
iptunnel ip tunnel
nameif ip link
ifconfig ip address
ifconfig $interface [up|down] ip link set dev $interface [up|down]
ifconfig $interface $ip netmask $netmask ip addr add $ip/$mask dev $interface
route add default gw $gateway ip route add default via $gateway
route add -net $net netmask $netmask gw $gateway ip route add $net/$mask via $gateway
route del -net $net gw $gateway netmask $netmask dev $device ip route del $net/$mask via $gateway
route -n ip route
ip address add $ip/$mask dev $interface
ip address del $ip/$mask dev $interface

The iproute2 sub commands can be specified with the shortest unambiguous name (ie. a or addr for address).

The ip address add $ip/$mask dev $interface will add additional IP addresses to the device. If it already has an existing IP address, you will need to use ip address del $ip/$mask dev $interface to remove it.

Some other commands: