I have the following routing table:

Routing Table Snapshot

say I get packet with dest IP and the next hop IP is that of a logical VLANIF94 interface.

please explain what all steps will happen here like MAC rewrite, VLAN tagging etc.


A layer 3 switch will do both routing and switching. In this case:

  1. The packet arrives on some layer 3 interface. The destination IP is, and the MAC address on the incoming frame is the MAC address of the receiving interface.
  2. The routing table says packet should go out to a directly connected subnet on VLANIF94. A new ethernet frame has to be built containing the same dest IP, but with the dest MAC address set to the address of, which needs to be found through ARP.
  3. An ARP request "Who has" is broadcasted from the VLANIF94 interface. Since this is a vlan-interface, it will be sent out of all ports in vlan 94. The copies of the frame will be vlan tagged if they go out of a tagged port, and untagged if they go out of an access port.
  4. An ARP reply will be received informing the router of the MAC address for, and the original packet can be sent out VLANIF94 in a frame using this MAC address as its destination.
  5. The frame will be sent out the switch port in vlan 94 which is listed with that dest MAC address in the MAC address table (this entry was learned in step 4).

So, as a router, your layer 3 switch will forward the IP packet in a frame with different MAC addresses. As a switch, it will do vlan tagging if needed when sending the packet on the switchport. The same is true for the incoming packet, it could have been tagged or untagged.

  • hi Gerben,but the next hop is, so should it not be the MAC of the next hop rather than the MAC of dest IP?? Dec 24 '14 at 12:05
  • 1
    Your layer 3 switch is directly connected to and can talk to directly. I'm guessing you are using a Huawei, and the column is indeed called Nexthop, but in the case of a directly connected subnet, that Nexthop is the IP address of the router's interface in that subnet. (Have a look at lines in the table that do not contain 'Direct'. There will be a next hop pointing to an IP outside of the destination network, exception if it is the default route to
    – Gerben
    Dec 24 '14 at 12:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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