Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In one of the programs I am writing, I need to find some hosts on a network. I don't know how many will be out there, and it is possible that the network might be larger than class C.

Somebody suggested I look into a MAC layer broadcast, but there isn't very much information when I search through Google. Can anyone explain how this works or where I can find some more info about this?

share|improve this question
up vote 3 down vote accepted

In networking you have the layers of the OSI model:

  1. Physical
  2. Data link (MAC layer)
  3. Network (IP layer)
  4. Transport (TCP layer)
  5. etc.

The data link layer and network layer are both broken out into segments by your router. This means that you can broadcast to all hosts on your VLAN (typically in the same subnet) by either layer 2 or 3. For example if you have 4 computers plugged into a single switch on the same vlan and in IP range you can send a packet that will be broadcast to all 4 computers using either of the following methods:

  • Layer 2: Send a frame out to mac address ff:ff:ff:ff:ff:ff
  • Layer 3: Send an IP packet out to IP address

If you're planning on using TCP or UDP I would go with the layer 3 broadcast. If you're planning on connecting to machines that do not have IP addresses go with layer 2.

To be clear you're not going to be able to use broadcast packets to find hosts on different subnets. For this you would need a central server or something like multicast which must be supported and enabled on all of your routers.

share|improve this answer
Thanks for the explanation. Is there some easy way to send a frame to a mac address using the windows command line? Or does that require some kind of deeper implementation? – Adam Feb 8 '12 at 15:19
I don't believe from the command line it's possible to send any specific frames, only layer 3 packets. What are you trying to do? – resmon6 Feb 8 '12 at 16:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .