Map MAC adresses to hostname

  • Hi people, I need to achieve this thing as soon as possible.
    I have ten Virtual Chassis with kind of 1200 nodes, I need to get hostname of every device connected to any port in any switch, and really don´t know how to do this in a “massive” way, i mean, quickly, not one by one.
    Is there any way??
    By now I have to take DHCP from windows, look for MAC adreeses from the juniper, and find them in the DHCP list (it has name, IP and MAC), but I think it should be some line command to do this

    thank a lot, !!

  • Thank again Mario!

    Yes, that´s right, i am doing as you say.
    I have almost 1000 MAC , 17 VLANs and 40 sw juniper ex 4200 series.

    As you say I use IP adress management (DHCP), list every vlan, open scope, open, adress leases, export that list to an excell and then cross that excel with the one that has the MAC, and I get an idea, but I really thought there would be some cli command that could invoke the external dhcp asking for the info.

    I really thanks your answers and your patience, I am new, but I will try to tell what is happenig so my problems/solutions can help anyone,

  • You’re showing the ARP table, and the switch resolves the hostnames for you to your DNS. This doesn’t mean the switch actually knowes the hostnames. This isn’t something you should be doing on the switch, this is administration you should be doing on your DHCP server:

    (Unique ID is the MAC address).

    What you can do, is write your own program. Export the MAC table of your switch, and try to match those MAC adresses againt the IP adresses in your DHCP (you should be able to get those via Powershell). How many MAC adresses are in the MAC table now?

  • Thanks again for your reply
    I understand l2 and l3, my mistake I didn´t tell I am working with EX4200, so I am using l3, so i can map hostnames and ip,
    for example
    show host domain name pointer

    show host agc-dgf-425 has address


    show arp no-resolve | match
    1c:6f:65:6c:xx:xx    vlan.0              none

    that is because my sw points to the dhcp server in order to get ip to give to any host who ask for it

    So we can see it returns hostname, ip , mac (l3 and l2, route/switch), the thing I can´t figure out is how to make it “massive”, get every port of every sw to tell me who is connected, instead of making it one by one.I supposse it also could be >>> sent to a txt or any file

    thanks a lot !!

  • I’m going to ask you again to look at the OSI Model:

    Because Layer3 and Layer2 are separate layers they work independently from each other. Maybe your DHCP server can map the MAC address to the hostname, but in Junos you can’t map those things (Junos isn’t aware of hostnames, and works only on MAC addresses (switching, layer2) and IP addresses (routing, layer3).

    I suggest (if you’re working professionaly with the Juniper products) you take a crash course in the basics of networking, that should help you figure out a lot of these basic questions :-).