Chitika

Inter vlan Routing in L2 Switch

Inter vlan Routing in L2 Switch


Above the figure, each host is in its own individual collision domain.


One host send a broadcast, every other host connected the switch is
going copy of that. That is real waste of switch resources and bandwidth.
Generally that is not desirable behavior.
So, that’s one reason for using Virtual LAN.
We have three hosts connected to a single switch, they are all in the
same subnet.
We want to create two vlans: Sales and Marketing.
Sales can not access Marketing and Marketing can not access Sales.
We can accomplish this by placing PC-1 to its own Sales vlan and PC-2,
PC-3 into Marketing vlan.
VLAN 10 Sales, VLAN 20 Marketing.
PC-1’s IP address: 10.0.0.2
PC-2’s IP address: 10.0.0.3
PC-3’s IP address: 10.0.0.4

Putting three IP addresses to three PCs.
Click PC-1/IP Configuration




Click PC-2/IP Configuration





Click PC-3/IP Configuration





As it is right now, these 2 VLANs have not been created. These computers are all in the same default VLAN or VLAN number 1, that exist in the switch already. So, if I ping to other computers, I would able to get reply from all machines. We should not any trouble of IP connectivity.This is because all ports in same VLANs.
Let’s ping PC-2 and PC-3 from PC-1.
Click PC-1/ Command Prompt
PC>ping 10.0.0.3
Pinging 10.0.0.3 with 32 bytes of data:
Reply from 10.0.0.3: bytes=32 time=14ms TTL=128
Reply from 10.0.0.3: bytes=32 time=8ms TTL=128
Reply from 10.0.0.3: bytes=32 time=9ms TTL=128
Reply from 10.0.0.3: bytes=32 time=9ms TTL=128
Ping statistics for 10.0.0.3:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 8ms, Maximum = 14ms, Average = 10ms

PC>ping 10.0.0.4
Pinging 10.0.0.4 with 32 bytes of data:
Reply from 10.0.0.4: bytes=32 time=15ms TTL=128
Reply from 10.0.0.4: bytes=32 time=10ms TTL=128
Reply from 10.0.0.4: bytes=32 time=8ms TTL=128
Reply from 10.0.0.4: bytes=32 time=8ms TTL=128
Ping statistics for 10.0.0.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 8ms, Maximum = 15ms, Average = 10ms
PC>
We get response, because they are in same vlans.

Let’s ping PC-1 and PC-3 from PC-2.
Click PC-2/ Command Prompt
PC>ping 10.0.0.2
Pinging 10.0.0.2 with 32 bytes of data:
Reply from 10.0.0.2: bytes=32 time=8ms TTL=128
Reply from 10.0.0.2: bytes=32 time=7ms TTL=128
Reply from 10.0.0.2: bytes=32 time=8ms TTL=128
Reply from 10.0.0.2: bytes=32 time=10ms TTL=128
Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 7ms, Maximum = 10ms, Average = 8ms

PC>ping 10.0.0.4
Pinging 10.0.0.4 with 32 bytes of data:
Reply from 10.0.0.4: bytes=32 time=17ms TTL=128
Reply from 10.0.0.4: bytes=32 time=9ms TTL=128
Reply from 10.0.0.4: bytes=32 time=8ms TTL=128
Reply from 10.0.0.4: bytes=32 time=6ms TTL=128
Ping statistics for 10.0.0.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 6ms, Maximum = 17ms, Average = 10ms
PC>
We get response, because they are in same vlans.

Let’s ping PC-2 and PC-1 from PC-3.
Click PC-3/ Command Prompt
PC>ping 10.0.0.2
Pinging 10.0.0.2 with 32 bytes of data:
Reply from 10.0.0.2: bytes=32 time=9ms TTL=128
Reply from 10.0.0.2: bytes=32 time=7ms TTL=128
Reply from 10.0.0.2: bytes=32 time=8ms TTL=128
Reply from 10.0.0.2: bytes=32 time=9ms TTL=128
Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 7ms, Maximum = 9ms, Average = 8ms

PC>ping 10.0.0.3
Pinging 10.0.0.3 with 32 bytes of data:
Reply from 10.0.0.3: bytes=32 time=8ms TTL=128
Reply from 10.0.0.3: bytes=32 time=8ms TTL=128
Reply from 10.0.0.3: bytes=32 time=9ms TTL=128
Reply from 10.0.0.3: bytes=32 time=10ms TTL=128
Ping statistics for 10.0.0.3:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 8ms, Maximum = 10ms, Average = 8ms
PC>
We get response, because they are in same vlans.

Let’s configure Switch for VLAN creation.
To create a VLAN is done in 3 steps:
1.Creating the VLAN numbers
2.Name the VLAN
3.Assign ports to the VLAN
Switch 2960
Switch>en
Switch#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#

First creating VLAN 10 or Sales VLAN.
Switch(config)#vlan 10
Switch(config-vlan)#name Sales
Switch(config-vlan)#exit
Switch(config)#

Creating VLAN 20 or Marketing VLAN.
Switch(config-vlan)#vlan 20
Switch(config-vlan)#name Marketing
Switch(config-vlan)#exit
Switch(config)#

Now, I need to assign ports for VLAN 10 and 20.
Making access port for Switch to PC, needs switchport mode access command.
Here, Switch’s fa 0/1 interface and PC’s interface are connected which is VLAN 10.
Switch(config)#int fa 0/1
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 10
Switch(config-if)#

Switch’s fa 0/2 interface and PC’s interface are connected which is VLAN 20.
Switch(config-if)#int fa 0/2
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#

Switch’s fa 0/3 interface and PC’s interface are connected which is VLAN 20.
Switch(config-if)#int fa 0/3
Switch(config-if)#switchport mode access
Switch(config-if)#switchport access vlan 20
Switch(config-if)#^Z
Switch#

Switch#show vlan brief
VLAN Name                             Status     Ports
---- -------------------------------- ---------   -------------------------------
1    default                               active        Fa0/4, Fa0/5, Fa0/6, Fa0/7
                                                                  Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                                  Fa0/12, Fa0/13, Fa0/14, Fa0/15
                                                                  Fa0/16, Fa0/17, Fa0/18, Fa0/19
                                                                  Fa0/20, Fa0/21, Fa0/22, Fa0/23
                                                                  Fa0/24, Gig1/1, Gig1/2
10   Sales                        active         Fa0/1
20   Marketing                   active         Fa0/2, Fa0/3
1002 fddi-default                    active   
1003 token-ring-default          active   
1004 fddinet-default               active   
1005 trnet-default                    active  
Switch#
Note:If a port is trunking, you do not see that port with the show vlan brief command. That port is trunking with another switch.

Remember, we are able to ping to all computers.
Because they were all in native vlan 1, the default vlan.
Now, test IP connectivity
let’s ping PC-2 and PC-3 from PC-1.
Click PC-1/Command Prompt
PC>ping 10.0.0.3
Pinging 10.0.0.3 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 10.0.0.3:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>
We get no response because different vlans.

PC>ping 10.0.0.4
Pinging 10.0.0.4 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 10.0.0.4:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>
We get no response because different vlans.

Let’s ping PC-1 and PC-3 from PC-2.
PC>ping 10.0.0.2
Pinging 10.0.0.2 with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.
Ping statistics for 10.0.0.2:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
PC>
We get no response because different vlans.

PC>ping 10.0.0.4
Pinging 10.0.0.4 with 32 bytes of data:
Reply from 10.0.0.4: bytes=32 time=14ms TTL=128
Reply from 10.0.0.4: bytes=32 time=7ms TTL=128
Reply from 10.0.0.4: bytes=32 time=8ms TTL=128
Reply from 10.0.0.4: bytes=32 time=8ms TTL=128
Ping statistics for 10.0.0.4:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 7ms, Maximum = 14ms, Average = 9ms
PC>
We get response because same vlan.
That simple configuration really helps to reduce broadcasts!
When all three hosts were in the same vlan and one host sends a broadcast,
the switch would make sure that all two of the other hosts received a copy.
Now, when a member of any given vlan sends a broadcast, only members of that same vlan will receive it





Free xml sitemap generator