Configuring Static VLANs – 2950 Series
Switch>enable
Switch#configure terminal
Switch(config)#hostname Switch_A
Switch_A(config)#enable secret class
Switch_A(config)#line con 0
Switch_A(config-line)#password cisco
Switch_A(config-line)#login
Switch_A(config-line)#line vty 0 15
Switch_A(config-line)#password cisco
Switch_A(config-line)#login
Switch_A(config-line)#exit
Switch_A(config)#interface Vlan1
Switch_A(config-if)#ip address 192.168.1.2 255.255.255.0
Switch_A(config-if)#no shutdown
Switch_A(config-if)#exit
Switch_A(config)#ip default-gateway 192.168.1.1
Switch_A(config)#end
Create and name two VLANs
Enter the following commands to create and name two VLANs:
Switch_A#vlan database
Switch_A(vlan)#vlan 2 name VLAN2
Switch_A(vlan)#vlan 3 name VLAN3
Switch_A(vlan)#exit
Assign ports to VLAN 2
Assigning ports to VLANs must be done from the interface mode. Enter the following commands to
add port 2 to VLAN 2:
Switch_A#configure terminal
Switch_A(config)#interface fastethernet 0/2
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 2
Switch_A(config-if)#end
Contoh lain
Assign ports to VLAN 2
Assigning ports to VLANs must be done from the interface mode. Enter the following commands to
add ports 4, 5 and 6 to VLAN 2.
Switch_A#configure terminal
Switch_A(config)#interface fastethernet 0/4
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 2
Switch_A(config-if)#interface fastethernet 0/5
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 2
Switch_A(config-if)#interface fastethernet 0/6
Switch_A(config-if)#switchport mode access
Switch_A(config-if)#switchport access vlan 2
Switch_A(config-if)#end
Look at only VLAN2 information
a. Instead of displaying all of the VLANs type the show vlan id 2 command at the Privileged
EXEC mode prompt as follows:
Switch_A#show vlan id 2
Look at only VLAN2 information with a different command (1900: Omit this step)
a. Instead of displaying all of the VLANs type the show vlan name VLAN2 command at the
Privileged EXEC mode prompt.
Switch_A#show vlan name VLAN2
Test the VLANs
Ping from the host in port 0/4 to the host in port 0/1.
a. Was the ping successful? No
b. Why? Different vlan membership
Ping from the host in port 0/1 to the host in port 0/4.
c. Was the ping successful? No
d. Why? Different vlan membership
Ping from the host in port 0/4 to the switch IP 192.168.1.2.
e. Was the ping successful? No
f. Why? Different vlan membership
Ping from the host in port 0/1 to the switch IP 192.168.1.2.
g. Was the ping successful? Yes
h. Why? Same vlan membership
Deleting VLAN Configurations – 2950 Series
Delete a Host from a VLAN
To remove a host from a VLAN, use the no form of the switchport commands in the port interface
configuration mode.
Switch_A#configure terminal
Switch_A(config)#interface fastethernet 0/4
Switch_A(config-if)#no switchport access vlan 2
Delete VLAN 1
a. Try to delete VLAN 1, which is the default VLAN, the same way that you deleted VLAN 3.
Switch_A#vlan database
Switch_A(vlan)#no vlan 1
A default VLAN may not be deleted.
Switch_A(vlan)#exit
Erasing and Reloading the Switch
For the majority of the labs in CCNA 3 and CCNA 4 it is necessary to start with an unconfigured
switch. Use of a switch with an existing configuration may produce unpredictable results. These
instructions allow preparation of the switch prior to performing the lab so previous configuration
options do not interfere. The following is the procedure for clearing out previous configurations and
starting with an unconfigured switch. Instructions are provided for the 2900, 2950, and 1900 Series
switches.
2900 and 2950 Series Switches
1. Enter into the Privileged EXEC mode by typing enable.
If prompted for a password, enter class (if that does not work, ask the instructor).
Switch>enable
2. Remove the VLAN database information file.
Switch#delete flash:vlan.dat
Delete filename [vlan.dat]?[Enter]
Delete flash:vlan.dat? [confirm] [Enter]
If there was no VLAN file, this message is displayed.
%Error deleting flash:vlan.dat (No such file or directory)
3. Remove the switch startup configuration file from NVRAM.
Switch#erase startup-config
The responding line prompt will be:
Erasing the nvram filesystem will remove all files! Continue? [confirm]
Press Enter to confirm.
The response should be:
Erase of nvram: complete
4. Check that VLAN information was deleted.
Verify that the VLAN configuration was deleted in Step 2 using the show vlan command. If
previous VLAN configuration information (other than the default management VLAN 1) is still
present it will be necessary to power cycle the switch (hardware restart) instead of issuing the
reload command. To power cycle the switch, remove the power cord from the back of the
switch or unplug it. Then plug it back in.
If the VLAN information was successfully deleted in Step 2, go to Step 5 and restart the switch
using the reload command.
5. Software restart (using the reload command)
Note: This step is not necessary if the switch was restarted using the power cycle method.
a. At the Privileged EXEC mode enter the command reload.
Switch#reload
The responding line prompt will be:
System configuration has been modified. Save? [yes/no]:
b. Type n and then press Enter.
The responding line prompt will be:
Proceed with reload? [confirm] [Enter]
The first line of the response will be:
Reload requested by console.
After the switch has reloaded, the line prompt will be:
Would you like to enter the initial configuration dialog? [yes/no]:
c. Type n and then press Enter.
The responding line prompt will be:
Press RETURN to get started! [Enter]