The gateway shields the MAC address and modifies the MAC address in Linux.

Source: Internet
Author: User

There is a machine in the LAN. Only some of the machines in the same network segment can be pinged or the gateway cannot be pinged. This is a strange phenomenon. I tried to modify the IP address and restart the network service, cannot solve the problem.

Check whether the gateway blocks the MAC address of the machine. Therefore, modify the MAC address of the machine as follows:

Ifconfig eth0 down

Ifconfig eth0 HW ether 00: 1A: A0: 38: E0: 31

Ifconfig eth0 up

If you do not disable the NIC first, the following error occurs: siocsifhwaddr: the device or resource is busy.

Because the SSH remote login is used, the machine does not have a keyboard and display. If the NIC is disabled, the connection will be disconnected. Therefore, the chmac. Sh script is written.

 

#! /Bin/sh

Ifconfig eth0 down

Ifconfig eth0 HW ether 00: 1A: A0: 38: E0: 31

Ifconfig eth0 up

 

# Chmod U + x chmac. Sh

# Nohup./chmac. Sh> a.txt 2> & 1 & // use the nohupruntime to prevent connections from being disconnected. After the shellshutdown is closed, the command can be executed without restrictions, and the output information is printed to a.txt.

 

You can use ifconfig to check and find that the MAC address has been successfully modified, and the gateway can ping the host. Due to the test, the machine sends a large amount of data, so the gateway is blocked by the Administrator, within the same CIDR Block, machines connected to the same vswitch can still be accessed, but those not on the same vswitch cannot be accessed, packets are blocked when they are routed.

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.