Broadcast

Hang on, how does "A" know what "B"'s MAC address is? If we look back up to the ifconfig output, we can see the "Bcast," or Broadcast address. This is configured to be the highest IP address available on the network. As this network is 192.168.1.0 - 192.168.1.255, the broadcast address is 192.168.1.255. This is a special address. If A wants to know "B"'s MAC address, it can broadcast a packet, addressed to 192.168.1.255, using ARP, asking who has 192.168.1.2. "B" (or potentially another device on the network) will reply with "B"'s MAC address. A packet sent to the broadcast address looks like this:

Source IP192.168.1.1(A)
Source MAC01:C0:F2:69:31:21(A)
Destination IP192.168.1.255(broadcast)
Destination MACFF:FF:FF:FF:FF:FF(broadcast)
DataWho has 192.168.1.2 ? Tell 192.168.1.1

Any machine on the network which knows the answer (but usually "B" itself) will reply with a fully-populated packet, including its own MAC address - any outgoing packet always includes the sender's IP and MAC address. This way, "A" can learn "B"'s MAC address if it needs to send it a packet.

Source IP192.168.1.2(B)
Source MAC0A:E1:23:28:AE:F2(B)
Destination IP192.168.1.1(A)
Destination MAC01:C0:F2:69:31:21(A)
Data192.168.1.2 is 0A:E1:23:28:AE:F2

The network card (NIC) listens to packets sent to itself, and also to packets sent to FF:FF:FF:FF:FF:FF. In a similar way, the IP Stack will listen to packets addressed to the IP broadcast address - 192.168.1.255 in this case (so long as the MAC address matches, otherwise the packet would already have been discarded by the NIC).

Networking Tutorial
Share on Twitter Share on Facebook Share on LinkedIn Share on Identi.ca Share on StumbleUpon

Want to take the tutorial with you?

My Shell Scripting Book:
    Shell Scripting, Expert Recipes for Linux, Bash and more
is available online and from all good booksellers.

Buy my 600-page Shell Scripting Book...

From Amazon USA:

From Amazon UK:

For Kindle:

Or From other retailers

You can also find the book, and join a shell scripting community, on Facebook:


Option Two: Buy the 70-page PDF (£4.99/$9.99/€6.99)
(Free Sample)

And you can always Download my Free Shell Scripting Cheatsheet PDF