3

How can I ping a specific IP on a network which only contain switches while switches as far as I know don't understand IPs but only MAC!

2
  • Look up ARP (Address Resolution Protocol) for IPv4 and ND (Neighbor Discovery) for IPv6.
    – Ron Maupin
    Jul 15, 2015 at 18:08
  • 1
    Maybe you can explain in a bit more details your network topology, configuration and what exactly you're trying to do, it's a bit unclear now.
    – Teun Vink
    Jul 15, 2015 at 22:37

2 Answers 2

6

You are correct the switch only knows/cares about the MAC.

When you send a ping, host#1 first generates a arp asking for the MAC of a specific ip_dst(host#2) with a MAC_dst(ffff.ffff.ffff),MAC_src(Host#1) broadcast that the switch then forwards to all ports .

Once the destination host#2 receives the broadcast, the host#2 will see that it is a ARP for it's own IP(host#2), and using the MAC from the received packet, reply back to the original host#1, using known MAC's as src(Host#2) and dst(Host#1).

Once the host#1 receives the ARP reply back, it has the MAC(host#2) and will cache the mapping of IP-MAC in the ARP table, it then send's the rest of the packet e.g. ping's using the destination MAC_dst(host#2).

The switches don't care that it is a ping or any other packet type it only uses the MAC_dst.

5
  • do you know of any tool for Linux or Windows to "ping" a MAC address (Layer 2 only... in the same LAN of course)
    – ZEE
    Feb 7, 2023 at 12:31
  • @ZEE no. (probably new question) on a hub every packet goes to every host "ping's"/reaches them, you need a higher level protocol to respond, eg ARP for IP. Have a look at baeldung.com/cs/protocols-ping, dhcp, smart-switch, nmap
    – Pieter
    Feb 9, 2023 at 19:28
  • and yet the NIC with the target MAC will ACKnowledge to the source/sender MAC... this should be enough to make a L2 ping tool... ?or am I missing something??
    – ZEE
    Feb 9, 2023 at 21:26
  • 1
    @ZEE yes the packet reaches the destination but the response is not at the mac layer, that just filters its own mac and broadcasts for higher layers, the response is done by higher level protocol, e.g. ARP that matches the IP before responding.
    – Pieter
    Feb 12, 2023 at 20:30
  • how can the the response be done to a higher layer if the source/sender has no IP yet? at this time is only able to communicate at L2/MAC level??
    – ZEE
    Mar 7, 2023 at 11:58
0

It might be helpful for you to start a packet trace (with something like wireshark) you will see that the first thing your local machine does when you issue the ping command is broadcast an APR packet (assuming it isn't already in the arp table) to the IP address you are trying to reach. Example:

  • IntelCor_00:00:88 Broadcast ARP 42 Who has 10.1.0.1? Tell 10.1.0.2

Once your local machine has the MAC address of the device your trying to reach it then assembles an ICMP (ping) packet with the destination MAC/IP combination. So your correct that the destination packet is a particular IP but that packet is then wrapped in a MAC frame and sent.

Hope that helps.

0

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