NET-TOOLS vs IPROUTE Cheat Sheet (ifconfig vs ip)

The net-tools has been deprecated and plans to obsolete was stated from debian-devel mailing list around 2009 (https://lists.debian.org/debian-devel/2009/03/msg00780.html ) . As per the post, it says:

It doesnt support many of the modern features of the linux kernel, the interface is far from optimal and difficult to use in automatisation, and also, it hasn’t got much love in the last years.

On the other side, the iproute suite, introduced around the 2.2 kernel line, has both a much better and consistent interface, is more powerful, and is almost ten years old, so nobody would say it’s untested.

So it’s time to familiarize and start using iproute over the net-tools. Here’s the table comparison of commands for your reference.

NET-TOOLS IPROUTE Description
ifconfig ip link Network device configuration
ifconfig -h ip help Print help
ifconfig -a ip  a Display all interfaces
ifconfig -a ip -4 a Display for family inet (ipv4)
ifconfig -a ip -6 a Display for family inet6 (ipv6)
ifconfig [int_name] ip a show [int_name] Display single interface
ifconfig [int_name] down ip link set [int_name] down Shutdown interface
ifconfig [int_name] up ip link set [int_name] up Activate interface
ifconfig eth0 hw ether 00:00:00:00:00:aa ip link set dev eth0 address 00:00:00:00:00:aa Change MAC address
ifconfig eth0 down
nameif eth1 00:00:00:00:00:aa
ifconfig eth1 up
ip link set dev eth0 down
ip link set dev eth0 name eth1
ip link set dev eth1 up
Rename interface (e.g eth0 to eth1)
ifconfig eth0  delete 192.168.0.100 ip addr del 192.168.0.100/24 dev eth0 Delete IPv4 address
ifconfig eth0 192.168.0.100 netmask 255.255.255.0 ip addr add 192.168.0.100/24 dev eth0 Add IPv4 address
ifconfig eth1 inet6 add 2002:bbaa:0:f000::1/64 ip -6 addr add 2002:bbaa:0:f000::1/64 dev eth1 Add IPv6 address
ifconfig eth0 0.0.0.0 ip addr del 192.168.0.100/24 dev eth0 Clear associated IP in interface
ifconfig eth0:0 192.168.0.100 netmask 255.255.255.0 ip addr add 192.168.0.100/24 dev eth0 label eth0:0 Create an alias in interface
ifconfig eth0:0 down ip addr del 192.168.0.100/24 dev eth0 Delete an alias
ifconfig eth0 mtu 1500 ip link set dev eth0 mtu 1500 Changeinterface  MTU
ifconfig eth0 arp ip link set dev eth0 arp on Enable ARP protocol
ifconfig eth0 -arp ip link set dev eth0 arp off Disable ARP protocol
ifconfig eth0 promisc ip link set dev eth0 promisc on Enable promiscuous mode
ifconfig eth0 -promisc ip link set dev eth0 promisc off Disable promiscuous mode
ifconfig eth0 multicast ip link set dev eth0 multicast on Enable Multicast
ifconfig eth0 -multicast ip link set dev eth0 multicast off Disable Multicast
ifconfig eth0 allmulti ip link set dev eth0 allmulticast on Enable All-Multicast
ifconfig eth0 -allmulti ip link set dev eth0 allmulticast off Disable All-Multicast
route -n ip route Display routing table
route add default gw 192.168.0.1 ip route add default via 192.168.0.1 Configure Default gateway
route del default gw 192.168.0.1 ip route del default via 192.168.0.1 Delete default gateway
route add -net 192.168.110.0 netmask 255.255.255.0 gw 192.168.0.1 dev eth1 ip route add 192.168.110.0/24 via 192.168.0.1 dev eth1 Add static route
route del -net 192.168.110.0 netmask 255.255.255.0 ip route del 192.168.110.0/24 Remove static route
arp -a ip neigh Display ARP
arp -v ip -s neigh Display ARP statistics
vconfig add eth0 10 ip link add eth0.10 link eth0 type vlan id 10 Create VLAN interface
vconfig rem eth0.10 ip link del dev eth0.10 Remove VLAN interface
netstat ss Print socket statistics
netstat -l ss -l Display only listening sockets
netstat -nr ip route show Display routing table
netstat -g ip maddr Display Multicast address
ipmaddr ip maddress multicast addresses management
iptunnel ip tunnel Configure tunnel

About the author

Free Linux

View all posts

Leave a Reply