What is a MAC layer broadcast?

1

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?

Adam

Posted 2012-02-08T13:59:06.593

Reputation: 15

Answers

3

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.

resmon6

Posted 2012-02-08T13:59:06.593

Reputation: 491

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 – 2012-02-08T15:19:33.997

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 – 2012-02-08T16:39:53.663