hosthit.blogg.se

Linux find mac address
Linux find mac address












linux find mac address
  1. LINUX FIND MAC ADDRESS FOR MAC
  2. LINUX FIND MAC ADDRESS UPDATE
  3. LINUX FIND MAC ADDRESS CODE

This is exactly what I want to get but for some reason the pexpect.spawn command doesn't work properly.īTW: I simply did 'MAC = ()' to capitalize the MAC Hex letters. print 'Failed to find IP address'įor some reason this 'child = pexpect.spawn ('arp -n | grep 0:15:AD:FF:81:93')' returns '|: Unknown host'

LINUX FIND MAC ADDRESS CODE

This bit of code is the problem:Ĭhild = pexpect.spawn ('arp -n | grep 0:15:AD:FF:81:93') Oh, and yes there is much more to my script in terms of getting the MAC address, subnet and other input values, so I don't actually hard code the MAC. No biggie, but just another little annoyance. so I'll have to switch them to upper case before doing the grep. I do an SNMP get to get my MAC address but when it passes it back to me the Hex letters are in lower case. However, I do have one problem with the grep command. I should have thought of this before - View image here: - Thanks. However, my testing environment is all behind the router and therefore all devices will have a subnet of 20 after switching to DHCP addressing. Basically that means with this method it won't show up. NOTE: there are blank spaces in the child.expect_exact calls as well but are weeded out by the format of the forum.Īnything not on your local subnet will probable show up as your router's mac address or not show up. print 'IP FOUND : DHCP_NID = %s'% DHCP_NID

LINUX FIND MAC ADDRESS FOR MAC

Print 'Searching for New DHCP IP address for MAC address %s. Thanks to all who helped me accomplish this task. If anyone sees any major issues, please let me know. Here's what I have in my script and it works. Just to share with the community - View image here:. There are numerous tools that will do this for you. No, I'm referring to ping sweeping, not pinging a broadcast addres.that is, ping each address in your subnet, incrementally. I was thinking maybe using Dynamic DNS and that way I could simply just use the host name of my device whether it has a static IP or using DHCP? But to do this I believe I would need to setup a server system to act as the DHCP and DNS server? Could there be a terminal command to display this lease table in Linux from my router? I can see the DHCP lease table through the web GUI to my router (and possibly some CLI commands to the router) but I would like to keep my scripts generic enough that they would work on other networks with different DHCP servers.

LINUX FIND MAC ADDRESS UPDATE

When you say Ping sweep the subnet, are you referring to broadcast pinging? ie: ping -b 192.168.20.255 to find all the devices on subnet 20?īroadcast ping does not seem to use arp requests and therefore does not update the arp table.














Linux find mac address