Difference between revisions of "VLAN Cisco IOS"

From Teknologisk videncenter
Jump to: navigation, search
m (Adding a range of ports to a VLAN)
m (Adding a range of ports to a VLAN)
Line 147: Line 147:
 
------- --------- ----------------- ------------------------------------------
 
------- --------- ----------------- ------------------------------------------
 
</pre>
 
</pre>
[Category:Cisco]][[Category:CCNA]][[Category:CCNP]][[Category:IOS]][[Category:Network]][[Category:CCNP3]]
+
[[Category:Cisco]][[Category:CCNA]][[Category:CCNP]][[Category:IOS]][[Category:Network]][[Category:CCNP3]]

Revision as of 01:20, 28 April 2009

Show commands

Switch1#sh vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gi0/1
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    active

Adding VLAN's

The VLAN configuration is stored in a file named VLAN.DAT

Switch1#dir
Directory of flash:/

    2  -rwx         128   Mar 26 2007 13:58:48  layout.text
    3  -rwx     2888547   Mar 01 1993 01:16:05  c2950-i6q4l2-mz.121-13.EA1.bin
    5  -rwx         616   Apr 27 2009 12:40:25  vlan.dat
    6  -rwx        1663   Mar 01 1993 00:05:49  config.backup-1.2
    7  drwx         832   Mar 04 1993 23:52:10  html
   21  -rwx         109   Mar 01 1993 00:04:30  info
   22  -rwx         109   Mar 01 1993 00:04:30  info.ver
    8  -rwx        3727   Mar 22 2009 10:12:56  config.text
   24  -rwx         306   Mar 01 1993 00:03:48  env_vars
   25  -rwx      880640   Mar 08 1993 22:39:07  html2.tar
   26  -rwx          47   Mar 22 2009 10:12:56  private-config.text

7741440 bytes total (1981952 bytes free)

Adding VLAN's from configure mode

To add VLAN's from configure mode is recomended.

Switch1#configure termi
Switch1#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch1(config)#vlan 100
Switch1(config-vlan)#name Admin
Switch1(config-vlan)#vlan 101
Switch1(config-vlan)#name Sales
Switch1(config-vlan)#vlan 102
Switch1(config-vlan)#name Students
Switch1(config-vlan)#^Z
Switch1#sh vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gi0/1
100  Admin                            active
101  Sales                            active
102  Students                         active
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    active

Adding VLAN's from database mode

You can add VLAN's from vlan database

Switch1#vlan database
% Warning: It is recommended to configure VLAN from config mode,
  as VLAN database mode is being deprecated. Please consult user
  documentation for configuring VTP/VLAN in config mode.
Switch1(vlan)#vlan 100 name Admin
VLAN 100 added:
    Name: Admin
Switch1(vlan)#vlan 101 name Sales
VLAN 101 added:
    Name: Sales
Switch1(vlan)#vlan 102 name Students
VLAN 102 added:
    Name: Students
Switch1(vlan)#exit
APPLY completed.
Exiting....
Switch1#sh vlan brief

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
                                                Gi0/1
100  Admin                            active
101  Sales                            active
102  Students                         active
1002 fddi-default                     active
1003 token-ring-default               active
1004 fddinet-default                  active
1005 trnet-default                    active

Access Ports

Access Ports are ports that are connected to specific vlans.

Adding a port statically to a VLAN

To put fastethernet 0/7 port in VLAN 102, use the following commands.

Switch1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Switch1(config)#interface fastethernet 0/7
Switch1(config-if)#switchport mode access
Switch1(config-if)#switchport access vlan 102

Adding a range of ports to a VLAN

To put fastethernet 0/8, 0/9, 0/12, 0/13, 0/14 and 0/22 in VLAN 102

Switch1(config)#interface range fastEthernet 0/8 - 14, fas
Switch1(config)#interface range fastEthernet 0/8 - 14, fastEthernet 0/22
Switch1(config-if-range)#switchport mode access
Switch1(config-if-range)#switchport access vlan 102

To view ports in VLAN Students

Switch1#sh vlan name Students

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
102  Students                         active    Fa0/7, Fa0/8, Fa0/9, Fa0/10
                                                Fa0/11, Fa0/12, Fa0/13, Fa0/14
                                                Fa0/22, Gi0/2

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
102  enet  100102     1500  -      -      -        -    -        0      0

Remote SPAN VLAN
----------------
Disabled

Primary Secondary Type              Ports
------- --------- ----------------- ------------------------------------------