Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_POSTS has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_posts.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_PAGES has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_pages.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_TAGS has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_tags.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_CATEGORIES has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_categories.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_SETTINGS has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_settings.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_COMMENTS has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_comments.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_NOTIFICATIONS has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_notifications.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; DB_USERS has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/db/db_users.class.php on line 12

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Login has a deprecated constructor in /home/iosnetwo/public_html/blog1/admin/kernel/api/login.class.php on line 12
IOS Network Simulator Blog - Welcome to the blog
IOS Network Simulator Welcome to the blog

PocketCLI Tutorial - Router on a Stick

 

In our last two tutorials we looked at VLANs and Trunking, where we created two VLANs on two switches and linked them with a trunk port. At the end of that tutorial, the VLANs of same ID were able to communicate across the two switches. In this tutorial, we shall look at how the different VLANs can communicate, known as Inter-VLAN routing, by configuring Router on a stick.


In this tutorial, we shall add a router to the previous topology, as seen below:

undefined

 

1. Setup the initial router configuration (This was covered in the previous tutorial).

2. Now on the router, we have to create sub-interfaces on port fa0/0 in order to route between the two VLANs. This sub-interface could be any number, but for the sake of manageability we shall assign 10 for VLAN 10, and 20 for VLAN 20. To achieve this, we have to enter the sub-interface, specify which VLANs this interface will be part of via encapsulation, and assign IP address to the sub-interfaces.

 

router1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
router1(config)#int fa0/0.10
router1(config-subif)#encapsulation dot1q 10
router1(config-subif)#ip address 192.168.1.254 255.255.255.0
router1(config-subif)#exit
router1(config)#int fa0/0.20
router1(config-subif)#encapsulation dot1q 20
router1(config-subif)#ip address 192.168.2.254 255.255.255.0
router1(config-subif)#exit
router1(config)#

In the above commands, we assigned the IP address 192.168.1.254/24 to the sub-interface 10, and 192.168.2.254/24 to the sub-interface 20 in order to put then on the same network as hosts on VLAN 10 and VLAN 20 respectively.

 

3. Now we need to force the port fa0/0 up

outer1(config)#int fa0/0
router1(config-if)#no shutdown
router1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
%LINK-5-CHANGED: Line protocol on Interface FastEthernet0/0, changed state to up

 

4. Since the router is directly connected to switch1 via fa0/3, we need to configure that port as a trunk on switch1

switch1(config)#int fa0/3
switch1(config-if)#switchport mode trunk
switch1(config-if)#

 

5. Assign default gateways to the hosts. 192.168.1.254 for hosts on VLAN 10, and 192.168.2.254 for hosts on VLAN 20.

undefined

 

undefined

 

6. Now let’s test connectivity by pinging Host2 on VLAN 20 from Host1 on VLAN 10 and vice versa.

undefined

 

Alternatively, this Inter-VLAN routing can also be achieved on a layer 3 switch. In this example, we shall remove the Router from the topology and make Switch1 a layer 3 switch.


a. Convert switch1 into a layer 3 switch with the command ip routing in global configuration mode. Note the change of the look of switch1 as in the image below:

switch1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
switch1(config)#ip routing

switch1(config)#

undefined

b. Assign the IP address 192.168.1.254/24 to interface vlan 10, and 192.168.2.254/24 to interface vlan 20 on switch 1

switch1(config)#int vlan 10
switch1(config-if)#ip address 192.168.1.254 255.255.255.0
switch1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Vlan 10, changed state to up
%LINK-5-CHANGED: Line protocol on Interface FastEthernet0/0, changed state to up

switch1(config)#int vlan 20
switch1(config-if)#ip address 192.168.2.254 255.255.255.0
switch1(config-if)#no shutdown
%LINK-5-CHANGED: Interface Vlan 20, changed state to up
%LINK-5-CHANGED: Line protocol on Interface FastEthernet0/0, changed state to up

 

c. Ping a host across the VLANs and see the successful reply.

 

 

Note: Don’t forget to run the copy running-config startup-config command on the switches and the router to save all configurations.

 

 

PocketCLI Tutorial - VLANs and Trunking

 

In the previous tutorial, we looked at how to create VLANs, assign ports to VLANs, and how to delete VLANs, all on one switch. In this tutorial, we shall look at how to configure VLANs on multiple switches, and how same VLANs on different switches can communicate; introducing a term known as Trunking.

In this tutorial, we shall create a lab in the Pocket CLI App to configure VLANs on two switches. Required devices for this lab are two Switches and four Hosts.

undefined

As in the screenshot above, connect Host0 to fa0/1 on switch1, Host2 to fa0/2 on Switch1, Host1 to fa0/1 on Switch2, and Host3 to fa0/2 on Switch2, all with a straight-through connection. Connect Switch1 and Switch2 via fa0/5 on both switches using a crossover connection.

1. Create VLAN 10 and VLAN 20 with IDs ACCT and MKT respectively on both switches.

On Switch1:

switch1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
switch1(config)#vlan 10
switch1(config-vlan)#name ACCT
switch1(config-vlan)#exit
switch1(config)#vlan 20
switch1(config-vlan)#name MKT
switch1(config-vlan)#

On Switch2 :

switch2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
switch2(config)#vlan 10
switch2(config-vlan)#name ACCT
switch2(config-vlan)#exit
switch2(config)#vlan 20
switch2(config-vlan)#name MKT
switch2(config-vlan)#

 

2. Assign IP address 192.168.1.1/24 to Host0 and 192.168.1.2/24 to Host1, putting them on the same network.

undefined

 

3. Assign IP address 192.168.2.1/24 to Host2 and 192.168.2.2/24 to Host3, putting both too on the same network.

undefined

 

4. On switch1, assign port fa0/1 to VLAN10 and fa0/2 toVLAN20.

switch1(config)#int fa0/1 
switch1(config-if)#switchport access vlan 10
switch1(config-if)#exit
switch1(config)#int fa0/2
switch1(config-if)#switchport access vlan 20

 

5. On switch2, assign port fa0/1 to VLAN10 and fa0/2 to VLAN20.

switch2(config)#int fa0/1
switch2(config-if)#switchport access vlan 10
switch2(config-if)#exit
switch2(config)#int fa0/2
switch2(config-if)#switchport access vlan 20

 

The above puts Host0 and Host1 on VLAN 10, and Host2 and Host3 on VLAN 20.

 

Now Host0 and Host1 are on the same VLAN but on different switches. For these two computers to be able to communicate, so as Host2 and Host3, we need to configure trunk ports. A trunk port is an interface that can carry multiple VLANs.

In this example, we configure int fa0/5 on both switches as trunk ports.

On Switch1:

switch1(config)#int fa0/5 
switch1(config-if)#switchport trunk encapsulation dot1q
switch1(config-if)#switchport mode trunk

 

On Switch2:

switch2(config)#int fa0/5 
switch2(config-if)#switchport trunk encapsulation dot1q
switch2(config-if)#switchport mode trunk

 

To view the trunk configuration on the switch, enter the command; show interface trunk as shown below:

switch1#show interface trunk
Port Mode Encapsulation Status Native vlan
Fa0/5 on 802.1q trunking 1

Port Vlans allowed on trunk
Fa0/5 1-1005

Port Vlans allowed and active in management domain
Fa0/5 1,10,20

Port Vlans in spanning tree forwarding state and not pruned
Fa0/5 1,10,20
switch1#

 

With this Host0 on switch1 and Host1 on swicth2 will be able to communicate, as well as Host2 and Host3. For Communication across VLAN 10 and VLAN 20, a Router is required, a configuration known as Router on Stick. This will be covered in future tutorials.

 

Success Tips:

a. Create VLANs that you really need. Too many unnecessary VLANs can make management difficult or cumbersome.

b. Assign only ports that needs to be on a particular VLAN and leave all other ports shutdown.

c. It is best to configure VLANs other than the default VLAN 1 for ports involved in communication.

d. It is best to put voice traffic and data traffic on separate VLANs.

 

 

PocketCLI Tutorial - VLAN Configurations

 

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

 

PocketCLI Tutorial - Initial Switch Configuration

 

In this tutorial, we shall look at the initial step-by-step configuration of a cisco switch in the Pocket CLI App. To get the nodes and your working area in the App, you first need to design a lab. In this case we are going to add a switch to the lab. To achieve this:

  1. Tap on Design on the main menu after you launch the App.
    undefined
  2. Tap on the little icon in the top-right corner of the screen and select Switch in the list and save.
    undefined
  3. Tap on the little icon at the top-right again and select save. Enter your desired Title and subtitle and save (In this case, Test and Test Lab respectively).
    undefined
  4. After saving it takes you back to the main menu. Now tap on Labs in the main menu and select the lab you just created.

After adding the switch we now set it up the first time for use. To power up the switch you added, simply tap on the Switch and select console. It loads and land you on a dialogue which reads ‘continue with configuration dialog? [yes/no]’. Since the Pocket CLI App is mostly for educational/training purposes it only accepts no as input. This is because the App wants you to go through the configurations manually.

After the switch has powered up, it takes you to user EXEC mode after pressing RETURN. The first thing to do is to setup a hostname for the switch. The hostname is basically the name of the switch. By default the App gives Switch0 for the first switch in a particular lab, Switch1 for the second, and so on. You can choose a hostname which best fits your lab. In this example we shall use HQ as the hostname of the switch.

To configure the hostname, navigate to Global Configuration mode and key in the command hostname HQ as shown below. The hostname immediately changes to hq. Please note that all entries in uppercase are changed to lowercase by the App.

Switch0(config)#hostname HQ
hq(config)#

After configuring the hostname you would want to disable name resolution. The reason for this is that, when you type a wrong command the device sees it as a name to IP address resolution, and this maybe take some time to resolve. To disable the domain name resolution on the switch, key in the command no ip domain-lookup in global config mode as shown below:

hq(config)#no ip domain-lookup

The next thing is to configure management IP address and default gateway for the switch. The default gateway is your Router’s IP address. See the commands below:

hq(config)#interface vlan1
hq(config-if)#ip address 192.168.5.1 255.255.255.0
hq(config-if)#no shutdown

For the default gateway, we navigate to global config mode. Simply enter the exit if you are in interface configuration mode to return to global configuration mode.

hq(config-if)#exit 
hq(config)#ip default-gateway 192.168.5.254

The next step in the initial configuration is to configure enable secret. The Cisco IOS has two main ways of protecting resources on the device; the enable password, and the enable secret. In this tutorial, we shall configure the enable secret, since it’s more secured than the enable password. The enable secret is encrypted with MD5 hash, whilst the enable password is stored in plain text. To set the enable secret, key in the enable secret Password (Where password is the password you want to set on the device) command. In this tutorial we use Cisco as our password.

hq>enable
hq#configure terminal Enter configuration commands, one per line. End with CNTL/Z.
hq(config)#enable secret Cisco

Next, we configure a console password. To do so, follow these steps:

hq(config)#line con 0
hq(config-line)#password Cisco1
hq(config-line)#login

The console password is set to Cisco1. You have to enter this password before you can get to the user EXEC mode.

Next, we configure the exec timeout for the console line. This is how long you want the console to automatically log you out after a specified time of inactivity. In this tutorial we shall set the exec timeout to 5 minutes. To configure the exec timeout for the console, simply key the exec-timeout 5 command in the config-console mode.

hq(config-console)#exec-timeout 5

Next, we configure telnet access or virtual terminals (vty) with a password. The Pocket CLI App’s switch supports up to 5 vty lines. To set password on the vty lines, navigate to global config mode and enter the following commands:

hq(config)#line vty 0 4 
hq(config-line)#password Cisco1
hq(config-line)#login
hq(config-line)#exec-timeout 5

It is always advisable to encrypt all passwords set on the device. To do so, simply use the service pass-encryption command to encrypt all passwords.

hq(config)#service password-encryption

To view all your configurations on the switch, key in show run in privileged mode. See an example in the screenshot below:

undefined

After you are done with all configurations do not forget to save all the changes. This will prevent the configurations from being lost when the device is rebooted. To do so, key in the command copy running-config startup-config in privileged mode.

hq#copy running-config startup-config

 

Keyboard Shortcuts and PocketCLI Auto-Complete

 

In the previous tutorial, we looked at getting used to the various prompts in the Pocket CLI App. In this tutorial, we will explore some keyboard shortcuts, and how to auto-complete commands.

 

Keyboard Shortcuts

There are several IOS keyboard shortcuts but we shall explore just a few, relevant to navigating around the Pocket CLI App.

At launch of the App, the only keyboard visible is your own smartphone’s keyboard. There is a ‘hidden’ keyboard (also known at the custom keyboard) that has the Tab, Ctrl, Alt, Break, and the Navigation/Arrow keys. To view this keyboard, tap on the dotted box at the top right corner of the screen as shown in the screenshot below. Tap on that same box to hide the keyboard again.

undefined

 

Below are some keyboard shortcuts supported by the App and what they do:

 

undefined

 

Note: Tapping at the beginning or end of a word moves the cursor to that location. Taping and holding within any word moves the cursor to that character in the word. These do pretty much the same thing as the first four listed commands in the table above.

 

Auto-Completing IOS Commands:

The App has two ways of auto-completing commands: Using the Tab key, and the Swipe option. I am going to demonstrate how to auto-complete the Configure Terminal command with the Tab key:

  1. While already in privileged mode, type conf and show the custom keyboard at the top right corner.

    undefined
  2.  Tap on tab to auto-complete it to configure.

    undefined
  3. Type t and tap on tab to auto-complete it to terminal, to get the full configure terminal command.

    undefined

The second and much simpler method to auto-complete this command is by swiping the text area towards the right. After typing conf, swipe right to get configure. Type t and swipe right to get terminal, and now you have the complete configure terminal command.

The auto-complete feature comes in handy in assisting you to enter commands quickly without having to enter the whole commands manually.

 

Home ← Older posts