By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,772 Members | 937 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,772 IT Pros & Developers. It's quick & easy.

Ping and ARP on both Win and Linux in Python

P: n/a
Hi, this is my question:

I want to know if several switch (about 50) in a big lan are up and then
know their MAC addresses to do a list that contains host name, ip and mac.
I know only the range of their IP addresses (the host name it's simply
to know using socket.gethostn.

The first idea it's to ping all ip, parse the response and then execute
the command "arp -a" and parse the response.
However this way depends on the operating system and the ping response
depends too from the language.

Another way it's to open the main page of the switch and parse the HTML
code where i can find the MAC address.
However this way depends on the particular brand's switch.

I know (or better i think) that there is a third way: make ping and arp
building the packets with socket and so on (but i dont have understand
in what way do this).

Any suggestion?

(i've already search in google, found many sources but a lot of them
don't works or don't do what im trying to do...)

Regards,
Mauretto.

Mar 13 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Mar 13, 9:14 pm, "Mauro \"Baba\" Mascia" <baba_...@yahoo.itwrote:
Hi, this is my question:

I want to know if several switch (about 50) in a big lan are up and then
know their MAC addresses to do a list that contains host name, ip and mac.
I know only the range of their IP addresses (the host name it's simply
to know using socket.gethostn.

The first idea it's to ping all ip, parse the response and then execute
the command "arp -a" and parse the response.
However this way depends on the operating system and the ping response
depends too from the language.

Another way it's to open the main page of the switch and parse the HTML
code where i can find the MAC address.
However this way depends on the particular brand's switch.

I know (or better i think) that there is a third way: make ping and arp
building the packets with socket and so on (but i dont have understand
in what way do this).

Any suggestion?

(i've already search in google, found many sources but a lot of them
don't works or don't do what im trying to do...)

Regards,
Mauretto.
There are several Ping /ICMP implentations in Python. I did something
similar using a python ping module and parsing the arp cache. A
different approach may be to use SNMP. I believe there are Python
tools around.
Mar 14 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.