getting IP and MAC of all peripherals

Drahos Madar

New Member


Messages: 1

Hey guys

I'm new @ BSD and this forum - so sorry if my question is duplicated or somehow not in line with rules of this web (as far as I have investigated none of those apply)

I was asked to write a program (python preff) which will return IP and MAC of all peripherals connected to server (multimedia devices in bus) and topography - schema of connection between those devices.

I assume something like that has to exist already, but I did not managed to find it here, nor google it.

So your expertise or directions would be very much appreciated.
 

Phishfry

Son of Beastie

Reaction score: 1,247
Messages: 3,614

From the command line:
ifconfig | grep ether ; ifconfig | grep inet
 

Phishfry

Son of Beastie

Reaction score: 1,247
Messages: 3,614

Most multimedia devices would not have a MAC address but a PCI address. That can be found with pciconf -l and USB devices have a UGEN schema that can be discovered with usbconfig dump_device_desc
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 7,292
Messages: 29,742

Most multimedia devices would not have a MAC address but a PCI address.
I think the OP means multimedia devices attached to the network. Like set-top boxes and media-streamers.

For network devices, ping the whole network and parse the output of arp -an.
 

usdmatt

Daemon

Reaction score: 514
Messages: 1,382

First time post and a question that isn't really specific to FreeBSD. I'll assume that you are actually trying to do this on FreeBSD.

If you mean devices actually connected to the FreeBSD machine (as in sending or receiving data from the server), you can look at the "Foreign Address" column in netstat -n to see any clients connected to the server. As SirDice says arp -an will show the MAC address of any LAN connected clients.

To find all devices on the LAN (those that respond to ping at least) you can do as SirDice says and just ping every address then check arp output.

There's no obvious way to work out the topology of the network or how devices are connected to each other. Clients could be directly cabled to FreeBSD, go through a switch, a bridge, etc and FreeBSD has no real way of knowing that.
 
Top