-->
🏠 🔍
SHAREOLITE

Inter VLAN routing Cisco Layer 3 switch

In this post , we share a step by step tested and working command line procedure for enabling Inter VLAN routing on a Cisco Layer 3 or L3 switch using Switch Virtual Interface (SVI).  In this simple example we cover the following topics

  • Create VLAN 100  , assign a IP to it (SVI) , connect a host 'A' to VLAN 100
  • Create VLAN 200 , assign a IP to it (SVI), connect a host 'B' to VLAN 200
  • Enable Inter VLAN routing so that host A may reach Host B


Create VLAN 100  , assign a IP to it (SVI) , connect a host 'A' to VLAN 100

Switch1 # config terminal
Switch1(config)#int vlan 100
Switch1(config-if)#description VLAN100
Switch1(config-if)#no shut
Switch1(config-if)#ip address 10.1.1.1 255.255.255.0   
Switch1(config-if)# ^Z

Switch1(config)#interface f1/0/1
Switch1(config-if)#switch access vlan 100
Switch1(config-if)#no shut


With the above steps , VLAN100 will be created and port f1/0/1 is assigned to VLAN100. Connect Host A to this port and assign a IP of range 10.1.1.X say for example 10.1.1.2. 

Verify whether Host A is able to reach the VLAN virtual interface 10.1.1.1 using ping command. Output should show a response as below 

Host A Terminal # ping 10.1.1.1

Pinging 10.1.1.1 with 32 bytes of data:

Reply from 10.1.1.1: bytes=32 time=1ms TTL=127
Reply from 10.1.1.1: bytes=32 time=1ms TTL=127


Create VLAN 200 , assign a IP to it (SVI), connect a host 'B' to VLAN 200

Switch1 # config terminal
Switch1(config)#int vlan 200
Switch1(config-if)#description VLAN200
Switch1(config-if)#no shut
Switch1(config-if)#ip address 20.1.1.1 255.255.255.0
Switch1(config-if)# ^Z

Switch1(config)#interface f1/0/2
Switch1(config-if)#switch access vlan 200
Switch1(config-if)#no shut


With the above steps , VLAN200 will be created and port f1/0/2 is assigned to VLAN200. Connect Host B to this port and assign a IP of range 20.1.1.X say for example 20.1.1.2. 

Verify whether Host B is able to reach the VLAN virtual interface 20.1.1.1 using ping command. Output should show a response as below 

Host B Terminal # ping 20.1.1.1

Pinging 20.1.1.1 with 32 bytes of data:

Reply from 20.1.1.1: bytes=32 time=1ms TTL=127
Reply from 20.1.1.1: bytes=32 time=1ms TTL=127

Now that both the VLANs are created and hosts are connected , lets check whether Host A is able to reach Host B by using ping . You should not observe any ping response and the destination is un-reachable / timeout as they belong to two separate IP ranges and on different VLAN.

Host B Terminal # ping 10.1.1.2

Pinging 10.1.1.2 with 32 bytes of data:

Request timed out
Request timed out

Enabling Inter VLAN routing

Well this is a very simple step. Just enable the IP routing option on your L3 switch . Some switches may require reboot to load the configuration . In such cases issue a reload command.

Verify whether IP routing feature is enabled , when disabled - status would be as below

Switch1#show ip route
Default gateway is not set
Host               Gateway           Last Use    Total Uses  Interface

ICMP redirect cache is empty

Switch1 # config terminal
Switch1(config)# ip routing
Switch1(config-if)# ^Z
Switch1 # reload


Once the switch reboots , verify the routing status and whether either hosts may reach the other end using ping command.


Switch1#show ip route
Codes: C - connected, S - static, R - RIP, M - mobile, B - BGP
       D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
       N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
       E1 - OSPF external type 1, E2 - OSPF external type 2
       i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
       ia - IS-IS inter area, * - candidate default, U - per-user static route
       o - ODR, P - periodic downloaded static route

Gateway of last resort is not set

     10.0.0.0/24 is subnetted, 1 subnets
     20.0.0.0/24 is subnetted, 1 subnets
C       10.1.1.0 is directly connected, Vlan100
C       20.1.1.0 is directly connected, Vlan200


Host A Terminal # ping 20.1.1.2

Pinging 20.1.1.2 with 32 bytes of data:

Reply from 20.1.1.2: bytes=32 time=1ms TTL=127
Reply from 20.1.1.2: bytes=32 time=1ms TTL=127

Host B Terminal # ping 10.1.1.2

Pinging 10.1.1.2 with 32 bytes of data:

Reply from 10.1.1.2: bytes=32 time=1ms TTL=127
Reply from 10.1.1.2: bytes=32 time=1ms TTL=127


Hope this helps to some beginners.

Cisco switch create VLAN, assign ports to VLAN, view VLAN properties


In this post we describe the set of tested and working cisco switch VLAN (Virtual LAN) command line options . This post covers the following topics

  • Creating a VLAN
  • Assigning a IP address or Switch Virtual Interface(SVI) to VLAN
  • Assigning a specific switch port to VLAN
  • Assigning a port range to VLAN
  • View VLAN properties
  • Delete a created VLAN


Creating a VLAN and Assigning IP address (SVI)


Switch1#config t

Switch1(config)#int vlan 100                     ( or just vlan 100 )
Switch1(config-if)#description ShareoLite
Switch1(config-if)#no shut
Switch1(config-if)#ip address 10.1.1.1 255.255.255.0
Switch1(config-if)#^Z

Assigning a specific port to VLAN

Switch1(config)#interface f2/0/1
Switch1(config-if)#switch access vlan 100
Switch1(config-if)#no shut

Switch1(config-if)#^Z

Assigning a port range to VLAN

Switch1(config)#interface range f2/0/1-16
Switch1(config-if-range)#switch access vlan 100
Switch1(config-if-range)#no shut
Switch1(config-if-range)#^Z

View VLAN details 


Switch1#show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa2/0/33, Fa2/0/34, Fa2/0/35
                                                Fa2/0/36, Fa2/0/37, Fa2/0/38
                                                Fa2/0/39, Fa2/0/40, Fa2/0/41
                                                Fa2/0/42, Fa2/0/43, Fa2/0/44
                                                Fa2/0/45, Fa2/0/46, Fa2/0/47
                                                Fa2/0/48, Gi2/0/1, Gi2/0/2
                                                Gi2/0/3, Gi2/0/4
100  Shareolite                       active    Fa2/0/1, Fa2/0/2, Fa2/0/3
                                                Fa2/0/4, Fa2/0/5, Fa2/0/6
                                                Fa2/0/7, Fa2/0/8, Fa2/0/9
                                                Fa2/0/10, Fa2/0/11, Fa2/0/12
                                                Fa2/0/13, Fa2/0/14, Fa2/0/15
                                                Fa2/0/16



Switch1#show ip interface brief

Interface              IP-Address      OK? Method Status                Protocol
Vlan1                  192.168.1.1    YES manual up                    down
Vlan100                10.1.1.1       YES manual up                    down


Switch1#show interfaces 
Vlan1 is up, line protocol is up
  Hardware is EtherSVI, address is 001c.8fb8.a2c0 (bia 001c.8fb8.a2c0)
  Internet address is 192.168.1.1/24
  MTU 1500 bytes, BW 1000000 Kbit, DLY 10 usec,
     reliability 255/255, txload 1/255, rxload 1/255
  Encapsulation ARPA, loopback not set
  Keepalive not supported
  ARP type: ARPA, ARP Timeout 04:00:00
  Last input 00:00:00, output 00:00:00, output hang never
  Last clearing of "show interface" counters never
  Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
  Queueing strategy: fifo
  Output queue: 0/40 (size/max)
  5 minute input rate 3000 bits/sec, 5 packets/sec
  5 minute output rate 0 bits/sec, 0 packets/sec
     2302 packets input, 181693 bytes, 0 no buffer
     Received 0 broadcasts (0 IP multicasts)
     0 runts, 0 giants, 0 throttles
     0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
     393 packets output, 34505 bytes, 0 underruns
     0 output errors, 2 interface resets
     0 output buffer failures, 0 output buffers swapped out

Delete/Remove a VLAN and its IP details (SVI)



Switch1#config t

Switch1(config)#int vlan 100                  
Switch1(config)#shut                  

Switch1#config t

Switch1(config)#no vlan 100                  

Hope this is useful to VLAN command line beginners.

How to configure Cisco switch VLAN and assign ports to VLAN in 5 minutes


Virtual LAN ports are widely used in switches to isolate different networks traffic in switches and routers . Below procedure is a quick 4 steps  5 minutes guide which should help you to configure a VLAN on switch and assign a port to it.



  • Step 1 : Open a serial port console cable from you laptop to the switch management port . Use a terminal program such as Hyper-Terminal , set the port properties as specified for your switch. Usually the settings would be Baud 9600 , Data bits - 8 , Parity - None , Stop Bits -1 , Flow control - None






  • Step 2 :  Check existing VLAN , create a new VLAN


cisco_sw1>
cisco_sw1> enable
cisco_sw1#
cisco_sw1# show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi1/0/1, Gi1/0/2, Gi1/0/3
                                                             
54   VLAN54                           active    Gi1/0/4, Gi1/0/5

Now lets create another VLAN 75

cisco_sw1# config terminal
Enter configuration commands, one per line.  End with CNTL/Z.
cisco_sw1(config)# vlan 75
cisco_sw1(config)# ^Z Press Cntrl Z
cisco_sw1# 

cisco_sw1# show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi1/0/1, Gi1/0/2, Gi1/0/3
                                                             
54   VLAN54                           active    Gi1/0/4, Gi1/0/5

75   VLAN75                           active



  • Step 3 :  Assigning a switch port say port no 6 to VLAN 75


cisco_sw1# config terminal
Enter configuration commands, one per line.  End with CNTL/Z.
cisco_sw1(config)# interface Gi1/0/6
cisco_sw1(config-if)# switchport access vlan 75
cisco_sw1(config-if)#^Z
cisco_sw1#
cisco_sw1# show interface status

Port      Name               Status       Vlan       Duplex  Speed Type
Gi1/0/1                      connected    1          a-full  a-100 10/100/1000Ba
seTX
Gi1/0/2                      notconnect   1            auto   auto 10/100/1000Ba
seTX
Gi1/0/3                      connected    1          a-full a-1000 10/100/1000Ba
seTX
Gi1/0/4                      connected    54          a-full a-1000 10/100/1000Ba
seTX
Gi1/0/5                      notconnect   54            auto   auto 10/100/1000Ba
seTX
Gi1/0/6                      notconnect   75            auto   auto 10/100/1000Ba

cisco_sw1# show vlan

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Gi1/0/1, Gi1/0/2, Gi1/0/3
                                                             
54   VLAN54                           active    Gi1/0/4, Gi1/0/5

75   VLAN75                           active    Gi1/0/6


cisco_sw1# show run   (To view full switch config)


  • Step 4 :  Save the configuration


cisco_sw1# wr
*Aug 25 12:12:04.413: %SYS-5-CONFIG_I: Configured from console by consoler
Building configuration...
[OK]

cisco_sw1# copy running-config startup-config
Destination filename [startup-config]?
Building configuration...
[OK]
0 bytes copied in 0.933 secs (0 bytes/sec)

cisco_sw1# exit

Hope this helps to some Cisco switch config beginners.

–>