Detailed explanation of Linux operating system Ifconfig command

  

Computer shop news Whether it is automatic installation of Linux or manual installation, Linux will ask you about network problems and configure related software. The basic command for configuring a NIC is ifconfig.

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

※ifconfig [interface]

※ifconfig interface [aftype] option |  Address …

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

After installing the system, you actually use Linux without a network card or network connection, but ifconfig can work in wraparound mode, so that the computer thinks it is working on the network.

Now let's run the ifconfig command. The ifconfig command with no arguments can display the currently started network interface. The output 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 txqueuelen: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 parameters of the machine. The device name under the NIC /dev/eth0 and The hardware MAC address is 52:54:AB:DD:6F:61. The MAC address is the unique address owned by the manufacturer and owned by each network card.

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

ifconfig eth0 hw ether xx:xx: Xx:xx:xx:xx

Then restart, then use the ifconfig command to check it out, we will find that the MAC address of the network card has become xx:xx:xx:xx:xx:xx.

Follow-up Common NIC ip setting method:

Set directly through setup.

Configure multiple network cards ifconfig -a View network devices eth0 /eth1 /lo (loop).

ifconfig eth1 //device 1

ifconfig eth1 192.168.1.10 netmask 255.255.255.0 //set NIC subnet and ip

man ifconfig

ifconfig --help(T002)

Copyright © Windows knowledge All Rights Reserved