From What I know, IPs are used to communicate b/w two different networks say LAN1 and LAN2... and MACs are used to communicate within a LAN.. I think this because my instructor says that Hubs and Switches are used to communicate within a LAN, That's why, they're Physical and Data Link Layer Devices.. While Routers are Network Layer Devices, Meaning they are used to connect two different networks.. So Can you commuincate within a LAN, with help of MAC Addresses only ? NO IPs ?
3 Answers
Yes, Apparently I figured it out myself... so, if you craft your own packets, you can. I achieved this by using Python's Scapy library. and crafted Ethernet packets and successfully communicated over just MAC Address, without even touching the layer 3.
-
Programming and custom or proprietary protocols are off-topic here.– Ron Maupin ♦Aug 17, 2022 at 17:08
So Can you commuincate within a LAN, with help of MAC Addresses only ?
Yes, absolutely. That's actually what IP does, it uses the data link layer (L2) as transport vehicle, with the underlying layer having no idea what's going on above.
It is technically possible to run a transport protocol or even an application protocol directly on top of L2 - that was commonly used in the early days of network gaming. It is very clumsy though and has grown extremely complicated with more modern operating systems (requiring admin/root privileges or a fully fledged protocol stack handler), so it's not really practical.
And of course, "no IPs" doesn't exclude using different network-layer protocols like IPX or EtherTalk that are largely obsolete but would still work on top of the data link layer.
-
Oh, I know you said it's not really practical… is there any way I could see this in action…? Or maybe perform this ? I am familiar with Linux, Windows and Virtual Machines… Aug 11, 2022 at 12:07
-
@LoneWolf47 That is a host-specific question, making it off topic here. Since you'd need some custom coding, it might be appropriate for Stack Overflow. They'll want to see some code from you though.– Zac67 ♦Aug 11, 2022 at 13:10
-
-
@LoneWolf47 if you create a socket with AF_PACKET (on Linux at least) you can send L2 packets Aug 12, 2022 at 9:58
Of course, if you create your own communication protocols within the local network, it is only possible to communicate with the MAC address. however, this is not possible when it comes to messaging over TCP/IP protocols. The IP in the TCP/IP protocol stack tells you whether the message will be local or remote. So the answer the question is both yes and no.
-
Thank you, it was because of your words I figured out I had to create my own Packets and discovered Scapy. Thank you so much. Aug 17, 2022 at 16:40