Introduction to Ifconfig command usage under Linux

Source: Internet
Author: User

Ifconfig
The syntax for ifconfig is:

Ifconfig [-A] [-v] [-S] [[]


]

[[-]broadcast [


]]

[Netmask


]

[Up|down]

Where interface for the network card name, address for IP addresses, broadcast to set the broadcast address, followed by the address for broadcast addresses IP, netmask to set the subnet mask, then address for the subnet mask IP, up and down settings Current network card status, up indicates the current network card is enabled, down indicates that the current network card is turned off.

The common parameters of Ifconfig are as follows:

-A View all network card status

-V View version information for the ifconfig command

-S View statistics

Example:

1 The IP address of the first network card is set to 192.168.0.1:

Ifconfig eth0 192.168.0.1 (format: Ifconfig network device name IP address)

2 temporarily turn off or enable the network card:

Turn off the first Nic: Ifconfig eth0 down

Enable the first block card ifconfig eth0 up

3 Set the subnet mask of the first network card to 255.255.255.0:

Ifconfig eth0 netmask 255.255.255.0 (format: Ifconfig network device name netmask subnet mask)

We can also set the IP address and subnet mask at the same time:

Ifconfig eth0 192.168.0.1 netmask 255.255.255.0

4 View the status of the first NIC:

Ifconfig eth0

If you want to see all network card status, use the Ifconfig command without parameters directly.

Ifconfig output status information is very useful, let's briefly explain:

Several states are more important:

Up/down: Whether the network card is started, if it is down, it will certainly not be used;

The number of errors packets in the RX packets is too large to indicate a problem with the NIC when it is received;

The number of errors packages in TX packets is too large to indicate a problem with the NIC when it is sent;

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.