Linux TCP/IP Network Management tool: net-tools VS iproute2
Blog: http://www.simlinux.com
Many system administrators still use a combination of ifconfig, route, arp, and netstat commands to manage and troubleshoot network configurations. These commands are provided in net-tools packages, but iproute2 has been used in distributions such as Arch Linux and Centos7/RHEL7 to replace net-toolsiproute2 as another network configuration tool to replace the functions of net-tools.
Net-tools accesses and modifies the network configuration through procfs (/ proc) and ioctl system calls, while iproute2 communicates with the kernel through netlink socket; importantly, iproute2 has been doing well:
Https://www.kernel.org/pub/linux/utils/net/iproute2/
The following is a comparison between net-tools and iproute2:
List all network interfaces (including network cards that are not active) using net-tools:$ ifconfig-a to activate and shut down the network card using net-tools:$ sudo ifconfig eth2 up$ sudo ifconfig eth2 down using iproute2:$ sudo ip link set down eth2 $sudo ip link set up eth2 to configure the IPv4 address using net-tools:$ sudo ifconfig eth2 10.0.0.1 Universe 24 using iproute2:$ sudo ip addr add 10.0.0.1 Universe 24 dev eth2 Use net-tools to configure multi-IP:$ sudo ifconfig eth0:1 192.168.10.10 netmask 255.255.255.0 up$ sudo ifconfig eth0:2 192.168.10.15 netmask 255.255.255.0 up use iproute2 to configure multi-IP:$ sudo ip addr add 10.0.0.0.255 dev eth2 $sudo ip addr add 10.0.0.255 dev eth2 $sudo ip addr add 10.0.0.3 / 24 broadcast 10.0.0.255 dev eth2 View IP address of eth0 $sudo ip addr list dev eth0 remove the IPv4 address on the network card use net-tools:$ sudo ifconfig eth2 0 use iproute2:$ sudo ip addr del 10.0.0.1 and 24 dev eth2 check the IPv4 address configured on the network card use net-tools:$ ifconfig eth2 use iproute2:$ ip addr show dev eth2 if the network card is bound to multiple IP Iproute2 can display all addresses. Net-tools can only display one configured IPv6 address using net-tools:$ sudo ifconfig eth2 inet6 add 2002:0db5:0:f102::1/64$ sudo ifconfig eth2 inet6 add 2003:0db5:0:f102::1/64 using iproute2:$ sudo ip-6 addr add 2002:0db5:0:f102::1/64 dev eth2 $sudo ip-6 addr add 2003:0db5:0:f102::1/64 dev eth2 to view the IPv6 address configured on the network card using net-tools:$ ifconfig Eth2 uses iproute2:$ ip-6 addr show dev eth2 to remove IPv6 addresses from NICs using net-tools:$ sudo ifconfig eth2 inet6 del 2002:0db5:0:f102::1/64 to change Nic MAC addresses using iproute2:$ sudo ip-6 addr del 2002:0db5:0:f102::1/64 dev eth2 using net-tools:$ sudo ifconfig eth2 hw ether 08:00:27:75:2a:66 to use iproute2:$ sudo ip link set dev eth2 address 08VOG 00VOR 27VOR 75 : 2a:67 view routing table using net-tools:$route-n $netstat-rn using iproute2:$ iproute show to add modify default route using net-tools:$ sudo route add default gw 192.168.1.2 eth0 $sudo route del default gw 192.168.1.1 eth0 using iproute2:$ sudo iproute add default via 192.168.1.2 dev eth0 $sudo iproute replace default via 192.168.1.2 dev eth0 to add and delete static routes using net-tools: $sudo route add default gw 192.168.1.2 eth0 $sudo route del default gw 192.168.1.1 eth0 use iproute2:$ sudo iproute add default via 192.168.1.2 dev eth0 $sudo iproute replace default via 192.168.1.2 dev eth0 View socket Statistics use net-tools:$ netstat$ netstat-l use iproute2:$ ss$ ss-l View ARP Table use net-tools:$ arp-an use iproute2:$ ip neigh add and remove static ARP using net- Tools:$ sudo arp-s 192.168.1.100 tools:$ sudo arp-s 192.168.1.100 lladdr 00:0c:29:c0:5a:ef dev eth0 $sudo ip neigh del 192.168.1.100 dev eth0 addition, Delete and view the Multicast address using net-tools:$ sudo ipmaddr add 33 sudo ipmaddr del 4400 dev eth0 0001 dev eth0 01 dev eth0 $33 sudo ipmaddr del 3315 4400 dev eth0 01 ipmaddr show dev eth0 $netstat-g using the sudo ipmaddr del 331400 dev eth0 0001 dev eth0 $ipmaddr list dev eth0
Reference documentation:
Iproute2 HowTo http://www.policyrouting.org/iproute2.doc.html
Iproute2 man http://www.linuxfoundation.org/collaborate/workgroups/networking/iproute2/
RTnetlink http://www.man7.org/linux/man-pages/man7/rtnetlink.7.html
Netlink http://www.man7.org/linux/man-pages/man7/netlink.7.html