Latest TCP/IP network management tools in CentOS: net-tools VS iproute2
Blog: http://www.simlinux.com
Many System Administrators still use ifconfig, route, arp, and netstat commands to manage and troubleshoot network configurations. These commands are provided by the net-tools Package, however, in the Arch Linux, Centos7/RHEL7 and other releases, iproute2 has replaced the net-toolsiproute2 is another network configuration tool, used to replace the net-tools function;
Net-tools accesses and modifies network configurations through procfs (/proc) and ioctl system calls, while iproute2 communicates with the kernel through netlink socket, iproute2 has been developing 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 inactive network interfaces)Use net-tools: $ ifconfig-a to use iproute2: $ iplinkshow
Enable and disable NICsUse net-tools: $ sudoifconfigeth1up $ sudoifconfigeth1down use iproute2: $ sudoiplinksetdowneth1 $ sudoiplinksetupeth1
Configure an IPv4 addressUse net-tools: $ sudoifconfigeth110.0.0.1/24 use iproute2: $ Configure/24deveth1 Use net-tools to configure multiple IP addresses: $ sudoifconfigeth0: configure $ sudoifconfigeth0: Configure multiple IP addresses using iproute2: $ sudoipaddradd10.0.0.1/24broadcast10. 0.0.255deveth1 $ sudoipaddradd10.0.0.2/24broadcast10. 0.0.255deveth1 $ sudoipaddradd10.0.0.3/24broadcast10. 0.0.255deveth1 view the IP address of eth0 $ sudoipaddrlistdeveth0
Remove the IPv4 address from the NICUse net-tools: $ sudoifconfigeth10 use iproute2: $ sudoipaddrdel10.0.0.1/24deveth1
View the IPv4 address configured on the NICUse net-tools: $ ifconfigeth1 use iproute2: $ ipaddrshowdeveth1 if the network adapter is bound with multiple IP addresses, iproute2 can display all addresses, while net-tools can only display one
Configure IPv6 addressesUse net-tools: $ sudoifconfigeth1inet6add2002: 0db5: 0: f102: 1/64 $ route: 0db5: 0: f102: 1/64 use iproute2: $ sudoip-6addradd2002: 0db5: 0: f102 :: 1/64deveth1 $ sudoip-6addradd2003: 0db5: 0: f102: 1/64deveth1
View the IPv6 address configured on the NICUse net-tools: $ ifconfigeth1 use iproute2: $ ip-6addrshowdeveth1
Remove the IPv6 address from the NICUse net-tools: $ sudoifconfigeth1inet6del2002: 0db5: 0: f102: 1/64 using iproute2: $ sudoip-6addrdel2002: 0db5: 0: f102: 1/64deveth1
Change the nic mac addressUse net-tools: $ sudoifconfigeth1hwether08: 00: 27: 75: 2a: 66 use iproute2: $ sudoiplinksetdeveth1address08: 00: 27: 75: 2a: 67
View route tableUse net-tools: $ route-n $ netstat-rn use iproute2: $ iprouteshow
Add and modify the default routeUse net-tools: $ sudorouteadddefaultgw192.168.1.2eth0 $ sudoroutedeldefaultgw192.168.1.1eth0 using iproute2: $ sudoiprouteadddefavia192.168.1.2deveth0 $ renew
Add and delete static routesUse net-tools: $ sudorouteadddefaultgw192.168.1.2eth0 $ sudoroutedeldefaultgw192.168.1.1eth0 using iproute2: $ sudoiprouteadddefavia192.168.1.2deveth0 $ renew
View socket statisticsUse net-tools: $ netstat-l use iproute2: $ ss-l
View ARP tableUse net-tools: $ arp-an to use iproute2: $ ipneigh
Add and delete static ARPUse net-tools: $ sudoarp-s192.168.1.10000: 0c: 29: c0: 5a: ef $ sudoarp-d192.168.1.100 use iproute2: $ sudoipneighadd192.168.1.100lladdr00: 0c: 29: c0: 5a: efdeveth0 $ Export
Add, delete, and view multicast addressesUse net-tools: $ sudoipmaddradd33: 44: 00: 00: 01deveth0 $ sudoipmaddrdel33: 44: 00: 00: 00: 01deveth0 $ ipmaddrshowdeveth0 $ netstat-g use iproute2: $ sudoipmaddradd33: 44: 00: 00: 01deveth0 $ sudoipmaddrdel33: 44: 00: 00: 00: 01deveth0 $ ipmaddrlistdeveth0
Reference:
Iproute2 HowTohttp: // 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