Linux TCP/IP network management tools: Net-tools VS iproute2

Source: Internet
Author: User
Tags arch linux

Many system administrators still use Ifconfig, route, ARP, netstat command combinations to manage and debug network configurations, which are provided by the Net-tools package, but in the arch Linux, centos7/ RHEL7 and other distributions have been replaced with Iproute2 Net-toolsiproute2 is another network configuration tool to replace the function of net-tools;

Net-tools Access and modification of the network configuration is done through PROCFS (/PROC) and IOCTL system calls, while Iproute2 communicates with the kernel via a netlink socket; Importantly, IPROUTE2 development has been very good:
https://www.kernel.org/pub/linux/utils/net/iproute2/
Here is the comparison of the use of Net-tools and Iproute2:

List all network interfaces (including network cards that are not activated)
Use net-tools:$ ifconfig-a using iproute2:$ IP link Show
Activating and shutting down the network card
Use net-tools:$ sudo ifconfig eth1 up$ sudo ifconfig eth1 down using iproute2:$ sudo IP link set down eth1$ sudo IP link set up E Th1
Configuring IPV4 Addresses
Use net-tools:$ sudo ifconfig eth1 10.0.0.1/24 using iproute2:$ sudo ip addr add 10.0.0.1/24 dev eth1 using Net-tools configuration multi ip:$ sudo ifco Nfig 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 with Place multi ip:$ sudo IP addr add 10.0.0.1/24 broadcast 10.0.0.255 dev eth1$ sudo ip addr add 10.0.0.2/24 broadcast 10.0.0.255 Dev E th1$ sudo ip addr add 10.0.0.3/24 broadcast 10.0.0.255 dev eth1 view eth0 IP address $sudo ip Addr List dev eth0
Remove the IPV4 address from the NIC
Use net-tools:$ sudo ifconfig eth1 0 using iproute2:$ sudo ip addr del 10.0.0.1/24 dev eth1
View the IPV4 address configured on the NIC
Use the net-tools:$ ifconfig eth1 to use iproute2:$ IP addr Show Dev eth1 if the NIC is bound to multiple IPs, IPROUTE2 can display all the addresses, and Net-tools can only display a

Configuring IPV6 addresses

Using net-tools:$ sudo ifconfig eth1 inet6 add 2002:0db5:0:f102::1/64$ sudo ifconfig eth1 inet6 add 2003:0db5:0:f102::1/64 use IP route2:$ sudo ip-6 addr add 2002:0db5:0:f102::1/64 dev eth1$ sudo ip-6 addr add 2003:0db5:0:f102::1/64 dev eth1
View the IPV6 address configured on the NIC
Using the net-tools:$ ifconfig eth1 using iproute2:$ ip-6 addr Show Dev eth1
Remove the IPV6 address from the NIC
Use net-tools:$ sudo ifconfig eth1 inet6 del 2002:0db5:0:f102::1/64 using iproute2:$ sudo ip-6 addr del 2002:0db5:0:f102::1/64 D EV eth1
Change the NIC MAC address
Use net-tools:$ sudo ifconfig eth1 hw ether 08:00:27:75:2a:66 use iproute2:$ sudo ip link set dev eth1 address 08:00:27:75:2a:6 7
View the routing table
Use Net-tools: $route-n$ netstat-rn use iproute2:$ IP route show
Add modify default route
Use 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 ip r Oute add default via 192.168.1.2 dev eth0$ sudo ip route replace default via 192.168.1.2 Dev eth0
Adding and removing static routes
Use 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 ip r Oute add default via 192.168.1.2 dev eth0$ sudo ip route replace default via 192.168.1.2 Dev eth0
View Socket Statistics
Use net-tools:$ netstat$ netstat-l using iproute2:$ ss$ ss-l
viewing ARP Tables
Use net-tools:$ arp-an with iproute2:$ IP neigh
Adding and removing static ARP
Use net-tools:$ sudo arp-s 192.168.1.100 00:0c:29:c0:5a:ef$ sudo arp-d 192.168.1.100 using iproute2:$ sudo ip neigh add 192.168 .1.100 lladdr 00:0c:29:c0:5a:ef dev eth0$ sudo ip neigh del 192.168.1.100 dev eth0
Add, remove, and view multicast addresses
Using net-tools:$ sudo ipmaddr add 33:44:00:00:00:01 dev eth0$ sudo ipmaddr del 33:44:00:00:00:01 dev eth0$ ipmaddr show Dev E  th0$ netstat-g using iproute2:$ sudo ip maddr add 33:44:00:00:00:01 dev eth0$ sudo ip maddr del 33:44:00:00:00:01 dev eth0$ ip Maddr List Dev eth0

Reference Documentation:
Iproute2 HowTo http://www.policyrouting.org/iproute2.doc.html
Iproute2 Mans 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

Linux TCP/IP network management tools: Net-tools VS iproute2

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.