Understand the eth0, eth1, eth2, and lo Nic configurations in linux

Source: Internet
Author: User

Eth0, eth1, eth2 ...... Indicates network adapter 1, network adapter 2, network adapter 3 ......
Lo represents 127.0.0.1, that is, localhost

Refer:

Linux Command: ifconfig

Function Description: displays or sets network devices.

Syntax: ifconfig [network device] [down up-allmulti-arp-promisc] [add <address>] [del <address>] [

Note: ifconfig can be used to set the status of network devices or display the current settings.

Parameters:

The name of the [network device] network device.

Down to disable the specified network device.

Up to start the specified network device.

-Arp: Enables or disables the ARP protocol used on the specified interface. Add a negative sign to disable this option.

-Allmuti: no difference between disabling or starting a specified interface. Add a negative sign to disable this option.

-Promisc: Disable or start the promiscuous mode of the specified network device. Add a negative sign to disable this option.

Add <address> set the IPv6 IP address of the network device.

Del <address> Delete the IPv6 IP address of the network device.

Media <network media type> sets the media type of the network device.

Mem_start <memory address> sets the starting address occupied by the network device in the main memory.

Metric <quantity> specifies the number of data packets to be added when calculating the number of data packets to be transferred.

Mtu <byte> sets the MTU of the network device.

Netmask <subnet mask> sets the subnet mask of the network device.

Tunnel <address> establishes the tunnel communication address between IPv4 and IPv6.

-Broadcast <address> processes data packets sent to the specified address as broadcast data packets.

-The pointopoint <address> is directly connected to the network device of the specified address. This mode has the confidentiality function.

Linux Nic Editing Command

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 device name/dev/eth0 of the nic and the MAC address of the hardware are shown as 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

Jiania commentary note:

Eth0, eth1, and eth2 indicate network adapter 1, network adapter 2, and network adapter 3.

Hw stands for hardware

Ether indicates ethernet.

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

Ifconfig

Configure the IP address of the NIC

Ifconfig eth0 192.168.0.1 netmask 255.255.255.0

Configure the IP address and 24-bit mask of 192.168.0.1 on eth0. What if I want to configure another IP address 192.168.1.1/24 on eth0? Use the following command

Ifconfig eth0: 0 192.168.1.1 netmask 255.255.255.0

Then run the ifconifg command to view the information of the two NICs: eth0 and eth0: 0. if you want to add more IP addresses, the name of the NIC will be: eth0: 1, eth0: 2 ...... Enter a few if you want. OK!

Configure the hardware address of the NIC

Ifconfig eth0 hw ether xx: xx changes the hardware address of the NIC. In this case, you can cheat the IP address bonding in the LAN.

Disable Nic

Ifconfig eth0 down

Enable the NIC

Ifconfig eth0 up

The ifconfig command has powerful functions. You can also set the MTU and hybrid mode of the NIC.

From: http://blog.csdn.net/vebasan/archive/2010/04/22/5515235.aspx

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.