Summary of MAC addresses and Ifconfig commands permanently changed under Linux

Source: Internet
Author: User

1. Fix a MAC address, especially when using multiple virtual machines

In the Linux environment:
Log in as root and add these three sentences to the/etc/rc.d/rc.local.

Ifconfig eth0 Down
ifconfig eth0 hw ether 00:0c:18:ef:ff:ed
Ifconfig eth0 up

So again after the reboot is not afraid of Mac recovery.

2. Ifconfig order (reprint http://www.cnblogs.com/taobataoma/archive/2007/12/27/1016689.html)

Ifconfig [Interface]

Interface is an optional option. Suppose this is not added. Displays information about all network cards in the system. Assuming this option is added, the specified NIC information is displayed

For example: Ifconfig eth0

Eth0 Link encap:ethernet            HWaddr 00:0c:29:f3:3b:f2            inet addr:192.168.0.10 bcast:192.168.0.255 Mask : 255.255.255.0 up            broadcast RUNNING multicast mtu:1500 metric:1            RX packets:78 errors:0 dropped:0 overruns:0 frame:0            TX packets:104 errors:0 dropped:0 overruns:0 carrier:0            collisions:0 txqueuelen:100            RX bytes:11679 (11.4 Kb)            TX bytes:14077 (13.7 Kb)            interrupt:10 Base address:0x1080

We can see

First line: Connection type: Ethernet (Ethernet) HWADDR (Hardware MAC address)

Second line: IP address, subnet, mask of network card

Third line: Up (for Nic on) RUNNING (network cable on behalf of the NIC is connected) multicast (support multicast) mtu:1500 (Maximum transmission Unit): 1500 bytes

Line fourth to fifth: Receive, send packet statistics

Line seventh: Receive, send data byte count statistics.

2, ifconfig configuration network card

Configure the IP address of the network card

Ifconfig eth0 192.168.0.1 netmask 255.255.255.0

Configure the IP address and the 24-bit mask on the eth0 on the 192.168.0.1. What 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. will be able to see the information of two network cards. respectively: Eth0 and eth0:0. If you want to add IP again, then the name of the network card is: eth0:1, eth0:2 ... you can fill in a few. Ok!

Configure the hardware address of the NIC

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

The hardware address of the network card is changed, at this time you can deceive the LAN IP address of the state.

Disable the network card

Ifconfig eth0 Down

Enable the network card

Ifconfig eth0 up

Summary of MAC addresses and Ifconfig commands permanently changed under Linux

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.