Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
add comment

1 Answer

up vote 1 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 192.168.1.0/24 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 192.168.1.255

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.