How To Configure a Simple VLAN Topology?

Well, this article explains how to design and configure a simple VLAN topology.I use following topology to achieve the same.

Objective: Design and configure the 3 VLANs each having single host as shown in the diagram.

Following are the steps to configure above vlan topology:

Step1: Select the IP address to suit the topology.

As VLAN breaks the broadcast domain, we need to select three different subnets.In above topology, each subnet needs two IP addresses.Hence i select Class-C network & 255.255.255.252 as subnet mask.I know you might have already guessed the reason behind selecting that subnet mask.This mask allows you to configure only two IP addresses per subnet.What are the possible subnets?well, its easy! subtract last octet value from 256, which is basically 256-252=4.Now, make the block size of 4.Following are the possible subnets:
192.168.221.0,192.168.221.4,192.168.221.8,192.168.221.12 & so on.
In each subnet lowest ip address is network address & highest IP address is broadcast address.If we choose first three subnets for our 3 VLANs, we can assign following IP addresses in the hosts/interfaces of each subnets:
192.168.221.1 & 192.168.221.2 =>VLAN1
192.168.221.5 & 192.168.221.6 =>VLAN2
192.168.221.9 & 192.168.221.10 =>VLAN3

Note: One VLAN=One SUBNET

We selected the two valid IP addresses for each subnets.Good to go..
.
Step2: IP address assignments & Inter-VLAN routing configuration.

PC0:   IP address=192.168.221.1
           Subnet mask=255.255.255.252
           Default gateway=192.168.221.2 
PC1:   IP address=192.168.221.5
           Subnet mask=255.255.255.252
           Default gateway=192.168.221.6
PC1:   IP address=192.168.221.9
           Subnet mask=255.255.255.252
           Default gateway=192.168.221.10
Router: As we have three different VLANs, inter-vlan communication is possible via Router only.We have to create three subinterfaces in the router sothat communication is possible via Trunk cable connected between switch & router.Now lets create three different subinterfaces & assign IP address to them in FastEthernet0/0 of Router.
Router(R1)(config)#interface FastEthernet0/0
Router(R1)(config)#no shutdown
Router(R1)(config-if)#int FastEthernet0/0.1
Router(R1)(config-subif)#encapsulation dot1Q 1
Router(R1)(config-subif)#ip address 192.168.221.2 255.255.255.252


Please Note: We can assign the IP address to the subinterface only if we are going to use VLAN.hence before configuring the IP address in subinterface you gotta chose the encapsulation you are going to use and VLAN number following by it.I've provided 1 which signifies VLAN1.

Router(R1)(config-if)#int FastEthernet0/0.2
Router(R1)(config-subif)#encapsulation dot1Q 2
Router(R1)(config-subif)#ip address 192.168.221.6 255.255.255.252


Router(R1)(config-if)#int FastEthernet0/0.3
Router(R1)(config-subif)#encapsulation dot1Q 3
Router(R1)(config-subif)#ip address 192.168.221.10 255.255.255.252

Step 3: Configure the switch and assign the switch interfaces to VLANs

First we need to assign first three interfaces of Switch to three VLANs each.Following achieves the same:

Switch(S1)(config)#interface FastEthernet0/1
Switch(S1)(config-if)#switchport mode access
Switch(S1)(config-if)#switchport access vlan 1


Switch(S1)(config)#interface FastEthernet0/2
Switch(S1)(config-if)#switchport mode access
Switch(S1)(config-if)#switchport access vlan 2

Switch(S1)(config)#interface FastEthernet0/3
Switch(S1)(config-if)#switchport mode access
Switch(S1)(config-if)#switchport access vlan 3

Next, we need to configure the Switch interface connected to the Router as Trunk.

Switch(S1)(config)#interface FastEthernet0/4
Switch(S1)(config-if)#switchport mode trunk
Switch(S1)(config-if)#switchport  trunk encapsulation dot1q

Now, try to ping from PC0 to PC1; it should be successful.This completes your simple VLAN configuration.


Comments