In this tutorial, we shall look at Virtual LANs (VLANs). VLANs are logical grouping of devices in the same broadcast domain. VLANs are usually configured on switches by placing some interfaces into one broadcast domain and some interfaces into another. A VLAN acts like a physical LAN, but it allows hosts to be grouped together in the same broadcast domain even if they are not connected to the same switch. They can be spread across multiple switches, with each VLAN being treated as its own broadcast domain. By default, all ports on a switch belong to the default VLAN, VLAN 1.

In this tutorial, we will create a simple Lab in the Pocket CLI App to configure VLAN on a switch. Devices we’ll use in this Lab are 1 Switch, and 4 Hosts. To setup this Lab:

  1. Tap on design on the main menu of the App.

    undefined
  2. Tap on the little icon in the top-right corner of the screen and select 1 switch and 4 hosts, as in the image below.

    undefined
  3. Connect the hosts to the switch. Connect host1’s nic to fa0/1, host2 to fa0/2, in that order. To connect them, tap and hold both the host and the switch and Straight-Through in the prompt. Repeat same for all hosts.

    undefined
  4. Tap on the little icon again, select Save and enter your desired name for the Lab. In this example we use VLAN.

  5. On the main menu, tap on Labs and select the Lab you just created.

  6. Assign IP addresses to the hosts. To achieve this, Tab on host1 and select Settings. Select LAN settings under NETWORK PROPERTIES. Assign the IP 192.168.1.2 and subnet mask 255.255.255.0 to host1, repeat the process for all host, but assign 192.168.1.3/24 to host2, 192.168.1.4/24 and 192.168.1.5/24 to host 3 and host 4 respectively.

    undefined
  7. Start up the Switch and setup the initial configurations (covered in the previous tutorial)



To configure VLANs on the switch, navigate to global configuration mode [switch(config)#]. In this tutorial we shall create 3 VLANs with IDs VLAN 100, VLAN 200, and VLAN 300 respectively. We shall assign Host 1 and Host 2 to VLAN 100, and Host 3 and 4 to VLAN 200, and then learn how to delete VLAN 300.

 

8. Create VLAN with ID 100 and name TECH.

hq(config)#vlan 100
hq(config-vlan)#name TECH 

 

9. Create VLAN with ID 200 and name MKT

hq(config)#vlan 200
hq(config-vlan)#name MKT

 

10. Create VLAN with ID 300 and name SALES

hq(config)#vlan 300
hq(config-vlan)#name SALES

 

11. Assign port 1 and port 2 to VLAN 100 and bring the ports up.

hq(config-if)#interface fa0/1 
hq(config-if)#switchport access vlan 100
hq(config-if)#no shutdown hq(config-if)#
hq(config-if)#interface fa0/2
hq(config-if)#switchport access vlan 100
hq(config-if)#no shutdown

 

12. Assign port 3 and port 4 to VLAN 200 and bring the ports up. We’ll do this by assigning both ports at once, with the interface range command.

hq(config)#int range fa0/3 – 4 
hq(config-if-range)#switchport access vlan 200
hq(config-if-range)#no shutdown

 

Now host1 and host2 are on the TECH VLAN, whilst host3 and host4 are on the MKT VLAN.

To test this, ping host2 from host1 and note there a reply. Ping either host3 or host4 from host1 and note that there is Request Timeout message. To achieve this, tap on Host1 and select Command Prompt. Enter the command ping 192.168.1.3 and note the reply.

Now ping Host 3(192.168.1.4) and note the request timed out reply. This means host1 and host2 are on 1 VLAN, and host3 and host4 are on another VLAN.

 

 

undefined

 

13. Delete VLAN 300. To delete VLAN 300 simply use the command below:

hq(config)#no vlan 300 

 

To view details of VLANs on a switch, enter the show vlan command in user exec mode.

 

 

Note: By default the Pocket CLI App Switch has 5 fastethernet port (can be increased up to 12 ports), and 2 gigabit ports