Detailed analysis of ifconfig commands in Centos

Source: Internet
Author: User
Whether it is Linux automatic installation or manual installation, Linux will ask you about network problems and configure related software. The basic command used to configure the NIC is ifconfig. After executing the ifconfig command, the system will set necessary parameters in the kernel table, so that Linux will know how to communicate with the network card. The ifconfig command has two formats: ※ifconfig [interface] ※ifconfigi

Whether it is Linux automatic installation or manual installation, Linux will ask you about network problems and configure related software. The basic command used to configure the NIC is ifconfig.

After executing the ifconfig command, the system will set necessary parameters in the kernel table, so that Linux will know how to communicate with the network card. The ifconfig command has the following two formats:

※Ifconfig [interface]

※Ifconfig interface [aftype] option | address...

The first format of ifconfig (or the ifconfig command without any parameters) can be used to view the network configuration of the current system.

After installing the system, you actually use Linux without a network adapter or network connection. However, ifconfig allows you to work in a loop to make the computer think that it is working on the network.

Now run the ifconfig command. the ifconfig command without parameters can display the currently started network interface. the output result is:

[Root @ machine1/sbin] # ifconfig

Eth0 Link encap: Ethernet Hwaddr 52: 54: AB: DD: 6F: 61

Inet addr: 210.34.6.89 Bcast: 210.34.6.127 Mask: 255.255.255.128

Up broadcast running multicast mtu: 1500 Metric: 1

RX packets: 46299 errors: 0 dropped: 0 overruns: 0 frame: 189

TX packets: 3057 errors: 0 dropped: 0 overruns: 0 carrier: 0

Collisions: 0 fig: 100

Interrupt: 5 Base address: 0xece0

Lo Link encap: Local Loopback

Inet addr: 127.0.0.1 Mask: 255.0.0.0

Up loopback running mtu: 3924 Metric: 1

RX packets: 44 errors: 0 dropped: 0 overruns: 0 frame: 0

TX packets: 44 errors: 0 dropped: 0 overruns: 0 carrier: 0

Collisions: 0 txqueuelen: 0

The part headed by eth0 is the Ethernet card configuration parameter of the local machine. The following figure shows the Nic device name/dev/eth0 and the hardware MAC address 52: 54: AB: DD: 6F: 61. the MAC address is set by the manufacturer. each Nic has a unique address.

However, you can manually change the MAC address of the NIC as long as we add the following to the network in/etc/rc. d/init. d:

Ifconfig eth0 hw ether xx: xx

Then restart and run the ifconfig command to check whether the MAC address of the NIC has changed to xx: xx.

How to set the IP address of a common network adapter:

Directly set through setup.

Configure multiple NICs ifconfig-a to view the network device eth0/eth1/lo (loop ).

Ifconfig eth1 // device 1

Ifconfig eth1 192.168.1.10 netmask 255.255.255.0 // Set the Nic subnet and ip address

Man ifconfig

Ifconfig -- help (T002)

Related Article

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.