Linux--eth0,eth1,eth2,lo and Ifconfig command __linux

Source: Internet
Author: User
What is Eth0,eth1,eth2,lo   eth0,eth1,eth2 ...   On behalf of a network card, network card two, network card three ......  Lo representative 127.0.0.1, that is localhost  reference:  Linux command:ifconfig    www.2cto.com   Function Description: Display or set up network equipment   syntax: ifconfig [network device][down up-allmulti-arp-promisc][add< address >][del< address >][< hardware address] [media< network Media type; [mem_start< memory Address Number of [metric<] [mtu< Byte] [netmask< Subnet Mask [tunnel< address;] [-broadcast< address;] [-pointopoint< address >]  Supplemental Note: Ifconfig can set the status of a network device, or display the current settings.   parameter:  the name of the network device network device.   down the specified network device.   Up to start the specified network device.  -arp to turn on or off the ARP protocol used on the specified interface. Preceded by a minus sign to turn off this option.  -allmuti to turn off or start a no-difference mode for the specified interface. Preceded by a minus sign to turn off this option.  -promisc to turn off or start the promiscuous mode for the specified network device. Preceded by a minus sign to turn off this option.   www.2cto.com   add< address > set the IP address of the network device IPV6.   del< address > Remove the IP address of the network device IPV6.   media< network Media type > Set the media type of the network device.   mem_start< memory address > Set the starting address that the network device occupies in the main memory.   Number of metric< > Specifies the number to be added when calculating the number of packets transferred.   mtu< bytes > Setting the MTU of a network device。   netmask< Subnet mask > Set subnet mask for network devices.   tunnel< address > Establish a tunnel communication address between IPV4 and IPV6.  -broadcast< address > packets destined for the specified address are treated as broadcast packets.  -pointopoint< address > establishes a direct connection with the network device at the specified address, which has a confidential function.     Linux to edit the command of the network card     Whether it is a Linux automatic installation or we manually installed, Linux will ask you about the network problems and configure the relevant software. The basic command for configuring the 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 NIC on the network. The Ifconfig command has the following two formats:  ※ifconfig [Interface] ※ifconfig interface [aftype] option | The first format of address ...  ifconfig (or using ifconfig commands without any arguments) can be used to view the network configuration of the current system.   After the system has just been installed, it is actually using Linux without a NIC or a network connection, but the ifconfig can be used to wrap around the way that the computer thinks it is working on the network.   Now let's run the Ifconfig command, the ifconfig command with no parameters can display the currently initiated network interface with the output of:  [Root@machine1/sbin] #ifconfig   eth0 Lin K encap:ethernet hwaddr 52:54:ab:dd:6f:61  inet addr:210.34.6.89 bcast:210.34.6.127 up Broadcast RUNNING multicast mtu:1500 metric:1  RX packets:46299 errors:0 dropped:0 overruns:0 Frame:189&nbsP TX packets:3057 errors:0 dropped:0 overruns:0 carrier:0  collisions:0 txqueuelen:100  Interrupt:5 Base addre ss: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 Overrun s:0 carrier:0  collisions:0 txqueuelen:0 
One of the eth0 is led by the local Ethernet card configuration parameters, the set here shows the device name of the network card/dev/eth0 and hardware MAC address 52:54:ab:dd:6f:61,mac address is manufacturer set, each network card has a unique address. But we can manually change the MAC address of the NIC, as long as we add in the network in/etc/rc.d/init.d/: ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx Note: eth0,eth1,eth 2, the representative network card one, network card two, network card three, HW represents hardware hardware meaning, Ether represents Ethernet Ethernet meaning
Then restart, and then use the Ifconfig command to view, we will find that the MAC address of the network card has become xx:xx:xx:xx:xx:xx.


Ifconfig Configure the NIC   Configure the IP address of the network adapter   ifconfig eth0 192.168.0.1 netmask 255.255.255.0  IP address on eth0 and 24-bit masks. What to do if you want to configure a 192.168.1.1/24 IP address on the eth0 again. Use the following command   ifconfig eth0:0 192.168.1.1 netmask 255.255.255.0  then use the IFCONIFG command to view, you can see the information of two network cards, respectively: Eth0 and eth0:0. If you want to add IP again, the name of the NIC is followed by: Eth0:1, Eth0:2 ... Just fill in a few if you want. Ok.   Configure the hardware address of the network card   ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx will change the hardware address of the network card, at this time you can fool over the IP address in the LAN state set.   Disable the NIC   ifconfig eth0 down  enable the network adapter   ifconfig eth0 up  ifconfig commands are very powerful, you can also set the network card's MTU, promiscuous mode Type and so on

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.