Get the MAC addresses of all the machines connected to a LAN when NO machines have got an IP address yet – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.
But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, networking, local-area-network, ethernet, mac-address.
Here is the real scenario. I have say 4 machines not having any IP address yet connected to a switch. In one of the machines (OS=CentOS), I would install a DHCP server and would provide the other machines IP addresses. Prior to assigning them IP addresses, I need to get the MAC address of each of the machines that I would assign IP addresses to.
So, my question here is how to I get the MAC addresses of all the machines connected to a switch when NO machine has got any IP address yet?
It’s mandatory for my use case that I won’t be having any IP addresses before the MAC addresses.
Ethernet switches have no way to show you mac-addresses of end stations before the end-stations send traffic; ethernet switches know what mac-address is attached by looking at the source mac-address field of the PC’s traffic.
If you use
802.1x authentication, you have a tiny window of time to get this information before they get an IP address from DHCP, but doing this reliably is impossible in the real world; everything happens too quickly.
If you need to know mac-addresses beforehand, then go to all PCs and conduct an inventory.
If the machines never talked to the network, this isn’t possible but if they communicated with the switch at least once and the switch is SNMP-capable, you could try to query the ARP table of the switch.
But with just four machines, just walk to them and write the MAC down.
Weird scenario… Can’t think of any situation in which this would make sense…
Setup the DHCP server to only supply reserved addresses (on MAC basis) and WITHOUT any dynamic DHCP pool.
That way the clients can request DHCP addresses all day long but won’t get any until you add them to the reserved addresses.
But because the clients are attempting to get DHCP their mac-addresses will be learned and stored in the CAM table of the switch.
You can’t get them from the server itself as far as I know. Normally mac-addresses can be seen in the ARP cache (arp -a command on most operating systems), but that is only AFTER there is an IP address linked to the MAC-address.