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.

I have a wireless router installed at my home (provided by ISP). Scenario:

Router IP: 192.168.1.1

My Machine IP (X): 192.168.1.2

IP of machine Y: 192.168.1.3

Now when I ping Y from my machine X.(ping 192.168.1.3 from 192.168.1.2)

My Routing table says: 

192.168.1.0     0.0.0.0         255.255.255.0   U     9      0        0 wlan0

This is a local route and now the ARP will be consulted for the MAC address of Y. Suppose Y has mac: yy:yy:yy:yy:yy:yy Thus a packet will be sent out from wlan0 towards the router with destination mac of Y.

Now How will the router forward the packet? Will it switched based on MAC or Layer 3 IP lookup will be used to forward in the packet?

share|improve this question

2 Answers 2

Real-world devices can do strange and terrifying things. But because these two devices are in the same network, we would expect the router to act like a switch and forward the packet based on the MAC address.

share|improve this answer
1  
This means that the router will not consult the ARP table when it will forward the packet within the same network? –  Sumit Trehan Jul 28 '13 at 18:58
1  
Correct. It will consult its CAM table, which the layer 2 equivalent of an ARP table, mapping MAC addresses to ports rather than IP addresses. –  David Schwartz Jul 28 '13 at 19:44

Home wireless routers combine several things

  • a (typically 4-port) switch
  • a router
  • a wireless access point

Wireless access points I believe keep track of MACs they have seen in the past, and know the MAC of each associated client of course. So if the wireless access point receives traffic from one associated client and it's going to another associated client, and "AP Isolation" is NOT disabled, there is no need for the wireless hardware to let any routing function (typically CPU code such as a Linux or VxWorks kernel) in the router know about it.

Whether or not that's what the hardware actually does is another matter entirely (I can imagine some cheap wireless hardware giving traffic destined for another wireless host on the same subnet to the CPU) - but even if it doesn't, the routing function (Linux kernel, etc.) should still route it back out of the wireless interface, because that is what the route table is telling it to do. This would be inefficient but wouldn't suprise me if due to cost it's done this way.

Assume you have 4 computers (A, B, C, D) connected to a switch, and then a 5th port connected to a router. If A wants to talk to B, the switch will know (through remembering MAC addresses that have passed through it) or find out (through flooding outgoing traffic to all ports and remembering who responds) which ports A and B are on, and can forward directly, and the router never gets involved. With wireless, all associated clients are basically on a "wireless switch" and it works (or should work) the same way.

So it should BRIDGE (that's the proper term for Layer 2, not ROUTE) based on Layer 2.

share|improve this answer

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.