Latest TCP/IP network management tools in CentOS: net-tools VS iproute2

Source: Internet
Author: User

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 NICs
Use net-tools: $ sudoifconfigeth1up $ sudoifconfigeth1down use iproute2: $ sudoiplinksetdowneth1 $ sudoiplinksetupeth1
Configure an IPv4 address
Use 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 NIC
Use net-tools: $ sudoifconfigeth10 use iproute2: $ sudoipaddrdel10.0.0.1/24deveth1
View the IPv4 address configured on the NIC
Use 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 addresses
Use 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 NIC
Use net-tools: $ ifconfigeth1 use iproute2: $ ip-6addrshowdeveth1
Remove the IPv6 address from the NIC
Use net-tools: $ sudoifconfigeth1inet6del2002: 0db5: 0: f102: 1/64 using iproute2: $ sudoip-6addrdel2002: 0db5: 0: f102: 1/64deveth1
Change the nic mac address
Use net-tools: $ sudoifconfigeth1hwether08: 00: 27: 75: 2a: 66 use iproute2: $ sudoiplinksetdeveth1address08: 00: 27: 75: 2a: 67
View route table
Use net-tools: $ route-n $ netstat-rn use iproute2: $ iprouteshow
Add and modify the default route
Use net-tools: $ sudorouteadddefaultgw192.168.1.2eth0 $ sudoroutedeldefaultgw192.168.1.1eth0 using iproute2: $ sudoiprouteadddefavia192.168.1.2deveth0 $ renew
Add and delete static routes
Use net-tools: $ sudorouteadddefaultgw192.168.1.2eth0 $ sudoroutedeldefaultgw192.168.1.1eth0 using iproute2: $ sudoiprouteadddefavia192.168.1.2deveth0 $ renew
View socket statistics
Use net-tools: $ netstat-l use iproute2: $ ss-l
View ARP table
Use net-tools: $ arp-an to use iproute2: $ ipneigh
Add and delete static ARP
Use 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 addresses
Use 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.