Home‎ > ‎cisco‎ > ‎IOS Switch Configs‎ > ‎

VLAN, SVI, and Binding Ports


Overview

Lets say you have a brand new switch, and you just want to connect to it quickly via IP (maybe to be able to upgrade the os or something).  In this doc we will go over how to create a VLAN, create a SVI, and then bond a switch port to that VLAN.  


Create the VLAN

Create the definition of a layer 2 broadcast domain on the switch (a VLAN).  

First connect via the console port to the switch and log in. (default user/pass is cisco / cisco)

get into enable mode (like admin mode or superuser), and then in config mode so that you can make changes to the switch

router> enable
router# configure terminal
router (config)#

create the layer2 vlan
vlan 3
 name purgatory

Create the SVI

The Switched Virtual Interface is the internal interface the switch has that is connected to the vlan.  If a switch has a SVI, then you can connect or ping the switch while connected to that VLAN.  Without it, you can't directly connect to the switch.  

While in conf t mode (where your prompt is router (config)# ), enter in the following: 

interface Vlan3
 description purgatory svi
 ip address 198.18.0.245 255.255.255.0
 no ip redirects
 no ip unreachables
 no ip proxy-arp

The first line interface vlan3 just defines the new vlan.  You can enter any free text after the description command.  Enter in the IP address of the SVI and the subnet mask after the ip address command.   The last three lines are for security.  

Bind the Ports to the VLAN

Here, we're just connecting the specified ports to the VLAN.  

Again, while in conf t mode (where your prompt is router (config)# ), enter in the following: 

interface GigabitEthernet1/1
 description laptop
 switchport access vlan 3
 switchport mode access
 spanning-tree portfast

You bind the interface to vlan 3 with the command switchport access vlan 3.  The switch knows that this is just a standard switchport with no vlan tagging by the command switchport mode access, and the port comes online right away, rather then the 30 second spanning tree port blocking because fo the command spanning-tree portfast.  

If you want to add more ports to the vlan, just repeat this for interface GigabitEthernet1/2interface GigabitEthernet1/3, etc.  

Stop making changes and save

When the prompt is still router (config)# you can do the following to finish the changes you just made. 

router (config)#end
router#wr mem
Building configuration...
Compressed configuration from 11768 bytes to 4835 bytes[OK].....
router#


Configure your laptop and test

Set your laptop up to an ip on the right vlan.  In this example, the laptop's IP would be 198.18.0.100 [255.255.255.0].  You don't need to add any IP in the default gateway, since we're not doing any routing yet on this interface.  

Once that's setup, make sure you can ping the SVI. 

laptop ~ $ ping 198.18.0.245
PING 198.18.0.245 (198.18.0.245): 56 data bytes
64 bytes from 198.18.0.245: icmp_seq=0 ttl=63 time=27.547 ms
64 bytes from 198.18.0.245: icmp_seq=1 ttl=63 time=27.308 ms
64 bytes from 198.18.0.245: icmp_seq=2 ttl=63 time=30.524 ms
^C
--- 198.18.0.245 ping statistics ---
3 packets transmitted, 3 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 27.308/28.460/30.524/1.463 ms
laptop ~ $



Comments