mac address table

Using perl to populate a switches MAC address table without an IP address.

The following script is useful for populating a switch's MAC address table with out using ARP or IP. This is accomplished with a single Perl module (Net::ARP) and by sending raw ethernet frames. This particular example it is assumed that all interfaces on are on the same L2 network (VLAN or otherwise) and uses the "primary" nic's IP address for the ICMP packet (though you could do it with an IPX packet or anything else). You could also use the gateway IP as well if you wanted it to show up in ARP.

This method doesn't produce any broadcasting or AllForward-L2 traffic to occur because the frame as a source and destination in it. Please take this as a proof of concept, but the below code did work in a production environment.

Syndicate content