Try the ip command in Linux. ifconfig is out of date.

Source: Internet
Author: User

Try the ip command in Linux. ifconfig is out of date.

Linux's ip commands are similar to ifconfig, but the former is more powerful and aims to replace the latter. Using ip commands, you can easily execute some network management tasks with only one command. Ifconfig is an obsolete command in net-tools. It has not been maintained many years ago. The iproute2 suite provides many enhanced functions. The ip command is one of them.

Practical application of CentOS ifconfig, route, and ip commands

Ifconfig cannot display the NIC after CentOS is installed

Practical application of CentOS ifconfig, route, and ip commands

Ifconfig: command not found

Ifconfig output network port and ip address in CentOS 6.2

To install the ip address, click here to download the iproute2 package. However, most Linux distributions are pre-installed with the iproute2 tool.

You can also use the git command to download the latest source code for compilation:

  1. $ Git clone https://kernel.googlesource.com/pub/scm/linux/kernel/git/shemminger/iproute2.git

Set and delete IP addresses

To set an ip address for your machine, you can use the following ip commands:

  1. $ Sudo ip addr add 192.168.0.193/24 dev wlan0

Note that the IP address must have a suffix, such as/24. This usage is used to display the subnet mask used in classless domain routing selection (CIDR. In this example, the subnet mask is 255.255.255.0.

After you set the IP address according to the above method, you need to check whether it has taken effect.

  1. $ Ip addr show wlan0

You can also delete an IP address in the same way. You only need to replace add with del.

  1. $ Sudo ip addr del192.168.0.193/24 dev wlan0

List route table entries

The parameters of the route object of the ip command can also help you view route data in the network and set your route table. The first entry is the default route entry. You can modify it at will.

In this example, there are several route entries. The result shows that several devices are connected through different network interfaces. They include WIFI, Ethernet, and a point-to-point connection.

  1. $ Ip route show

If you have an IP address, you need to know where the route package comes from. The following routing options can be used ):

  1. $ Ip route get10.42.0.47

For more details, please continue to read the highlights on the next page:

  • 1
  • 2
  • Next Page

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.