So here are my devices.
First thing is let's configure the router, So Fast
Ethernet00,
no shut interface Fast
Ethan00.1. So I'm going to create a subinterface with IP address 10.1.1.254
but notice what's gonna happen when I press enter.
I'm told that configuring IP routing on a LAN sub-interface is only allowed if that sub-interfaces are
already configured as part of an 802.1
Q or ISL VLAN. So I'm gonna type encapsulation .1Q VLAN 1 and this is our native VLAN or untagged
VLAN. So now I can put the IP address on that sub-interface, second sub-interface
.1Q VLAN 2 IP Address 10.1.2.254/24 mask third sub-interface.
This is gonna be encapsulation .1 VLAN 3 an IP address 10.1.3.254/24
mask.
So do show run pipe begin face.
So here is our FastEthernet interface, here
are our three sub interfaces that's how you configure inter VLAN routing on a router on a stick.
So let's configure our PCs, show IP shows that PC 1 doesn't currently have an IP address.
So IP 10.1.2.1/24 mask default gateway is the router, PC 2 IP Address 10.2.3.
1
10.1.3.254. So can PC 1 ping its default gateway?
Yes, it can.
What about PC 2?
It can also ping its default gateway.
So these two PCs can ping router 1 on the respect of sub- interfaces.
Can the PCs ping each other?
PC 1 ping 10.1.3.1, Ping succeeds, PC 2 ping 10.1.2.1 Ping succeeds. That traffic
is being switched to the router being inter VLAN routed and sent back to PC 2.
I'll do a wireshark capture in a moment
but notice what happens when I shut the physical interface FastEthernet00.
PC 1 is no longer able to ping PC 2 when no shut the interface on the router
interface comes up and pings start succeeding.
That's how you configure a layer 2 switch with different VLANs and an external router acting as a router
on a stick during the inter VLAN routing.
So now let's run a Wireshark capture so we can see what's actually happening.
I'm going to run the Wireshark capture on the switch so we can see the frames going to the router.
So when PC 1 pings PC 2 we should see that it's tagged with VLAN 2
but when it comes back again from the router it's tagged with VLAN 3
PC 1 ping PC 2.
So we can see the traffic from 10.1.2.1 going to 10.1.3.1 in the frame.
We can see it's tagged with the line to the destination MAC address of this frame.
Here's the router show interface f0/0
notice the Mac address
C201.1E3C.0000.
So that frame is going to the router tagged with VLAN 2 here's another frame
Notice the source Mac address is the router and the VLAN ID is VLAN 3.
So what's happened is the frame arrived on port 1 was sent out at port 3 going to the router tagged
with VLAN 2 and was received back from the router going to PC 2 but received on this port tagged as
VLAN 3
and once again there's the frame going to the router tagged with the VLAN 2
here's the frame from the router so source mac address of the router tagged with VLAN 3 the IP packet
is still from PC 1 going to PC 2.
So what about the return traffic.
Here's
traffic from PC 2 notice tagged with VLAN 3 going to the router.
So that's the frame here going to the router.
Here's the frame from the router tagged with the VLAN 2.
So once again here it's untagged hits the switch is tagged as VLAN 3 to the router
it's inter VLAN router tagged as VLAN 2 send sent back to the switch
untagged to pc 1.
So we are seeing the tag frame on port 3 from PC 2 to the router tagged in VLAN 3
and then here from the router to PC 1 tagged in VLAN 2.