Difference between revisions of "VLAN Cisco IOS"

From Teknologisk videncenter
Jump to: navigation, search
m
m (Adding a range of ports to a VLAN)
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
=Related topics=
 +
*[[VLAN Trunk Cisco IOS]]
 +
*[[Private VLAN Cisco IOS]]
 +
 +
=Cisco Materials=
 +
*[http://mars.tekkom.dk/cisco/ccnp3/ch2/2_2_1/index.html CCNP 3 chapter 2 Implementing VLAN's]
 +
 
= Show commands =
 
= Show commands =
<pre>
+
== Show vlan ==
Switch1#sh vlan brief
+
Gives a great view of ''VLAN's'' and which ports are assigned to it. Try also ''show vlan brief''
 +
<source lang="cli">
 +
SW2#<input>show vlan</input>
  
 
VLAN Name                            Status    Ports
 
VLAN Name                            Status    Ports
 
---- -------------------------------- --------- -------------------------------
 
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
+
1    default                          active    Fa0/1, Fa0/2, Gi0/2
                                                Fa0/5, Fa0/6, Fa0/7, Fa0/8
+
100  Admin                            active
                                                Fa0/9, Fa0/10, Fa0/11, Fa0/12
+
101  Sales                            active
                                                Fa0/13, Fa0/14, Fa0/15, Fa0/16
+
102  Students                        active    Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/17, Fa0/18, Fa0/19, Fa0/20
+
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/22
                                                Fa0/21, Fa0/22, Fa0/23, Fa0/24
+
1002 fddi-default                    act/unsup
                                                Gi0/1
+
1003 token-ring-default              act/unsup
1002 fddi-default                    active
+
1004 fddinet-default                  act/unsup
1003 token-ring-default              active
+
1005 trnet-default                    act/unsup
1004 fddinet-default                  active
+
 
1005 trnet-default                    active
+
VLAN Type  SAID      MTU  Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
</pre>
+
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
== Show VLAN Field Desriptions ==
+
1    enet  100001    1500  -      -      -        -    -        0      0
 +
100  enet  100100    1500  -      -      -        -    -        0      0
 +
101  enet  100101    1500  -      -      -        -    -        0      0
 +
102  enet  100102    1500  -      -      -        -    -        0      0
 +
1002 fddi  101002    1500  -      -      -        -    -        0      0
 +
1003 tr    101003    1500  -      -      -        -    -        0      0
 +
1004 fdnet 101004    1500  -      -      -        ieee -        0      0
 +
1005 trnet 101005    1500  -      -      -        ibm  -        0      0
 +
 
 +
Remote SPAN VLANs
 +
------------------------------------------------------------------------------
 +
 
 +
 
 +
Primary Secondary Type              Ports
 +
------- --------- ----------------- ------------------------------------------
 +
 
 +
</source>
 +
 
 +
 
 +
=== Show VLAN Field Descriptions ===
 
{|border=1 ;style="margin: 0 auto; text-align: center;cellpadding="5" cellspacing="0"
 
{|border=1 ;style="margin: 0 auto; text-align: center;cellpadding="5" cellspacing="0"
|+ IPv4 Multicast Address groups
+
|+ Show VLAN Field Descriptions
 
|- bgcolor=lightgrey
 
|- bgcolor=lightgrey
 
! Field !! Description
 
! Field !! Description
Line 31: Line 59:
 
|Ports || Ports taht belong to the VLAN
 
|Ports || Ports taht belong to the VLAN
 
|-
 
|-
|Type || VLAN number
+
|Type || Media type of the VLAN
 
|-
 
|-
|SAID || VLAN number
+
|SAID || Security Association ID value of the VLAN
 
|-
 
|-
|MTU || VLAN number
+
|MTU || Maximum Transfer Unit of the VLAN
 
|-
 
|-
|Parent || VLAN number
+
|Parent || Parent VLAN if existing
 
|-
 
|-
|RingNo || VLAN number
+
|RingNo || Ring Number of the VLAN, if applicable
 
|-
 
|-
|BrdgNo || VLAN number
+
|BrdgNo || Brudge number of the VLAN, if applicable
 
|-
 
|-
| STP|| VLAN number
+
| STP|| Spanning Tree Protocol type used on the VLAN
 
|-
 
|-
|BrdgMode || VLAN number
+
|BrdgMode || Bridging mode for this VLAN
 
|-
 
|-
|Trans1 || VLAN number
+
|Trans1 || Translation bridge 1
 
|-
 
|-
|AREHops || VLAN number
+
|AREHops || Maximum number of hops for all-routers explorer frames
 
|-
 
|-
|STEHops || VLAN number
+
|STEHops || Maximum number of hops for spanning tree explorer frames
 
|}
 
|}
 +
 +
== Show interfaces ==
 +
A quick summary of all ports and their status
 +
<source lang="cli">
 +
SW2#<input>show interfaces status</input>
 +
 +
Port      Name              Status      Vlan      Duplex  Speed Type
 +
....
 +
Fa0/8                        notconnect  102          auto  auto 10/100BaseTX
 +
Fa0/9                        notconnect  102          auto  auto 10/100BaseTX
 +
Fa0/10                      notconnect  102          auto  auto 10/100BaseTX
 +
....
 +
</source>
 +
== show switchport status ==
 +
<source lang="cli">
 +
SW2#<input>show interfaces fastEthernet 0/10 switchport</input>
 +
Name: Fa0/10
 +
Switchport: Enabled
 +
Administrative Mode: static access
 +
Operational Mode: down
 +
Administrative Trunking Encapsulation: dot1q
 +
Negotiation of Trunking: Off
 +
Access Mode VLAN: 102 (Students)
 +
Trunking Native Mode VLAN: 1 (default)
 +
Administrative Native VLAN tagging: enabled
 +
Voice VLAN: none
 +
Administrative private-vlan host-association: none
 +
Administrative private-vlan mapping: none
 +
Administrative private-vlan trunk native VLAN: none
 +
Administrative private-vlan trunk Native VLAN tagging: enabled
 +
Administrative private-vlan trunk encapsulation: dot1q
 +
Administrative private-vlan trunk normal VLANs: none
 +
Administrative private-vlan trunk private VLANs: none
 +
Operational private-vlan: none
 +
Trunking VLANs Enabled: ALL
 +
Pruning VLANs Enabled: 2-1001
 +
Capture Mode Disabled
 +
Capture VLANs Allowed: ALL
 +
 +
Protected: false
 +
Unknown unicast blocked: disabled
 +
Unknown multicast blocked: disabled
 +
Appliance trust: none
 +
</source>
  
 
= Adding VLAN's =
 
= Adding VLAN's =
 
The VLAN configuration is stored in a file named ''VLAN.DAT''
 
The VLAN configuration is stored in a file named ''VLAN.DAT''
<pre>
+
<source lang="cli">
Switch1#dir
+
Switch1#<input>dir</input>
 
Directory of flash:/
 
Directory of flash:/
  
Line 73: Line 145:
  
 
7741440 bytes total (1981952 bytes free)
 
7741440 bytes total (1981952 bytes free)
</pre>
+
</source>
 
== Adding VLAN's from configure mode ==
 
== Adding VLAN's from configure mode ==
 
To add VLAN's from ''configure'' mode is recomended.
 
To add VLAN's from ''configure'' mode is recomended.
<pre>
+
<source lang="cli">
Switch1#configure termi
+
Switch1#<input>configure terminal</input>
Switch1#configure terminal
 
 
Enter configuration commands, one per line.  End with CNTL/Z.
 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch1(config)#vlan 100
+
Switch1(config)#<input>vlan 100</input>
Switch1(config-vlan)#name Admin
+
Switch1(config-vlan)#<input>name Admin</input>
Switch1(config-vlan)#vlan 101
+
Switch1(config-vlan)#<input>vlan 101</input>
Switch1(config-vlan)#name Sales
+
Switch1(config-vlan)#<input>name Sales</input>
Switch1(config-vlan)#vlan 102
+
Switch1(config-vlan)#<input>vlan 102</input>
Switch1(config-vlan)#name Students
+
Switch1(config-vlan)#<input>name Students</input>
Switch1(config-vlan)#^Z
+
Switch1(config-vlan)#<input>^Z</input>
Switch1#sh vlan brief
+
Switch1#<input>sh vlan brief</input>
  
 
VLAN Name                            Status    Ports
 
VLAN Name                            Status    Ports
Line 105: Line 176:
 
1004 fddinet-default                  active
 
1004 fddinet-default                  active
 
1005 trnet-default                    active
 
1005 trnet-default                    active
</pre>
+
</source>
 +
==Seeing the VLAN's in running config==
 +
<source lang=cli>
 +
vtp mode transparant
 +
</source>
 
== Adding VLAN's from database mode ==
 
== Adding VLAN's from database mode ==
 
You can add VLAN's from ''vlan database''
 
You can add VLAN's from ''vlan database''
<pre>
+
<source lang="cli">
Switch1#vlan database
+
Switch1#<input>vlan database</input>
 
% Warning: It is recommended to configure VLAN from config mode,
 
% Warning: It is recommended to configure VLAN from config mode,
 
   as VLAN database mode is being deprecated. Please consult user
 
   as VLAN database mode is being deprecated. Please consult user
 
   documentation for configuring VTP/VLAN in config mode.
 
   documentation for configuring VTP/VLAN in config mode.
Switch1(vlan)#vlan 100 name Admin
+
Switch1(vlan)#<input>vlan 100 name Admin</input>
 
VLAN 100 added:
 
VLAN 100 added:
 
     Name: Admin
 
     Name: Admin
Switch1(vlan)#vlan 101 name Sales
+
Switch1(vlan)#<input>vlan 101 name Sales</input>
 
VLAN 101 added:
 
VLAN 101 added:
 
     Name: Sales
 
     Name: Sales
Switch1(vlan)#vlan 102 name Students
+
Switch1(vlan)#<input>vlan 102 name Students</input>
 
VLAN 102 added:
 
VLAN 102 added:
 
     Name: Students
 
     Name: Students
Switch1(vlan)#exit
+
Switch1(vlan)#<input>exit</input>
 
APPLY completed.
 
APPLY completed.
 
Exiting....
 
Exiting....
Switch1#sh vlan brief
+
Switch1#<input>sh vlan brief</input>
  
VLAN Name                            Status    Ports
+
LAN Name                            Status    Ports
 
---- -------------------------------- --------- -------------------------------
 
---- -------------------------------- --------- -------------------------------
 
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
 
1    default                          active    Fa0/1, Fa0/2, Fa0/3, Fa0/4
Line 143: Line 218:
 
1004 fddinet-default                  active
 
1004 fddinet-default                  active
 
1005 trnet-default                    active
 
1005 trnet-default                    active
</pre>
+
</source>
 +
 
 
= Access Ports =
 
= Access Ports =
 
Access Ports are ports that are connected to specific vlans.
 
Access Ports are ports that are connected to specific vlans.
 
== Adding a port statically to a VLAN ==
 
== Adding a port statically to a VLAN ==
 
To put ''fastethernet 0/7'' port in VLAN 102, use the following commands.
 
To put ''fastethernet 0/7'' port in VLAN 102, use the following commands.
<pre>
+
<source lang="cli">
Switch1#conf t
+
Switch1#<input>conf t</input>
 
Enter configuration commands, one per line.  End with CNTL/Z.
 
Enter configuration commands, one per line.  End with CNTL/Z.
Switch1(config)#interface fastethernet 0/7
+
Switch1(config)#<input>interface fastethernet 0/7</input>
Switch1(config-if)#switchport mode access
+
Switch1(config-if)#<input>switchport mode access</input>
Switch1(config-if)#switchport access vlan 102
+
Switch1(config-if)#<input>switchport access vlan 102</input>
</pre>
+
</source>
 
== Adding a range of ports to a VLAN ==
 
== 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
+
To put ''fastethernet 0/8, 0/9, 0/10, 0/11, 0/12, 0/13, 0/14 and 0/22 in VLAN 102
<pre>
+
<source lang="cli">
Switch1(config)#interface range fastEthernet 0/8 - 14, fas
+
Switch1(config)#<input>interface range fastEthernet 0/8 - 14, fastEthernet 0/22</input>
Switch1(config)#interface range fastEthernet 0/8 - 14, fastEthernet 0/22
+
Switch1(config-if-range)#<input>switchport mode access</input>
Switch1(config-if-range)#switchport mode access
+
Switch1(config-if-range)#<input>switchport access vlan 102</input>
Switch1(config-if-range)#switchport access vlan 102
+
</source>
</pre>
 
 
To view ports in VLAN Students
 
To view ports in VLAN Students
<pre>
+
<source lang="cli">
Switch1#sh vlan name Students
+
Switch1#<input>show vlan name Students</input>
  
 
VLAN Name                            Status    Ports
 
VLAN Name                            Status    Ports
Line 183: Line 258:
 
Primary Secondary Type              Ports
 
Primary Secondary Type              Ports
 
------- --------- ----------------- ------------------------------------------
 
------- --------- ----------------- ------------------------------------------
</pre>
+
</source>
 +
<!--
 +
{{Source cli}}
 +
-->
 
[[Category:Cisco]][[Category:CCNA]][[Category:CCNP]][[Category:IOS]][[Category:Network]][[Category:CCNP3]]
 
[[Category:Cisco]][[Category:CCNA]][[Category:CCNP]][[Category:IOS]][[Category:Network]][[Category:CCNP3]]

Latest revision as of 13:28, 9 October 2017

Related topics

Cisco Materials

Show commands

Show vlan

Gives a great view of VLAN's and which ports are assigned to it. Try also show vlan brief

SW2#<input>show vlan</input>

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa0/1, Fa0/2, Gi0/2
100  Admin                            active
101  Sales                            active
102  Students                         active    Fa0/8, Fa0/9, Fa0/10, Fa0/11
                                                Fa0/12, Fa0/13, Fa0/14, Fa0/22
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

VLAN Type  SAID       MTU   Parent RingNo BridgeNo Stp  BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1    enet  100001     1500  -      -      -        -    -        0      0
100  enet  100100     1500  -      -      -        -    -        0      0
101  enet  100101     1500  -      -      -        -    -        0      0
102  enet  100102     1500  -      -      -        -    -        0      0
1002 fddi  101002     1500  -      -      -        -    -        0      0
1003 tr    101003     1500  -      -      -        -    -        0      0
1004 fdnet 101004     1500  -      -      -        ieee -        0      0
1005 trnet 101005     1500  -      -      -        ibm  -        0      0

Remote SPAN VLANs
------------------------------------------------------------------------------


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


Show VLAN Field Descriptions

Show VLAN Field Descriptions
Field Description
VLAN VLAN number
Name Name of the VLAN, if configured
Status Status of the VLAN (Active or suspended)
Ports Ports taht belong to the VLAN
Type Media type of the VLAN
SAID Security Association ID value of the VLAN
MTU Maximum Transfer Unit of the VLAN
Parent Parent VLAN if existing
RingNo Ring Number of the VLAN, if applicable
BrdgNo Brudge number of the VLAN, if applicable
STP Spanning Tree Protocol type used on the VLAN
BrdgMode Bridging mode for this VLAN
Trans1 Translation bridge 1
AREHops Maximum number of hops for all-routers explorer frames
STEHops Maximum number of hops for spanning tree explorer frames

Show interfaces

A quick summary of all ports and their status

SW2#<input>show interfaces status</input>

Port      Name               Status       Vlan       Duplex  Speed Type
....
Fa0/8                        notconnect   102          auto   auto 10/100BaseTX
Fa0/9                        notconnect   102          auto   auto 10/100BaseTX
Fa0/10                       notconnect   102          auto   auto 10/100BaseTX
....

show switchport status

SW2#<input>show interfaces fastEthernet 0/10 switchport</input>
Name: Fa0/10
Switchport: Enabled
Administrative Mode: static access
Operational Mode: down
Administrative Trunking Encapsulation: dot1q
Negotiation of Trunking: Off
Access Mode VLAN: 102 (Students)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: enabled
Voice VLAN: none
Administrative private-vlan host-association: none
Administrative private-vlan mapping: none
Administrative private-vlan trunk native VLAN: none
Administrative private-vlan trunk Native VLAN tagging: enabled
Administrative private-vlan trunk encapsulation: dot1q
Administrative private-vlan trunk normal VLANs: none
Administrative private-vlan trunk private VLANs: none
Operational private-vlan: none
Trunking VLANs Enabled: ALL
Pruning VLANs Enabled: 2-1001
Capture Mode Disabled
Capture VLANs Allowed: ALL

Protected: false
Unknown unicast blocked: disabled
Unknown multicast blocked: disabled
Appliance trust: none

Adding VLAN's

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

Switch1#<input>dir</input>
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#<input>configure terminal</input>
Enter configuration commands, one per line.  End with CNTL/Z.
Switch1(config)#<input>vlan 100</input>
Switch1(config-vlan)#<input>name Admin</input>
Switch1(config-vlan)#<input>vlan 101</input>
Switch1(config-vlan)#<input>name Sales</input>
Switch1(config-vlan)#<input>vlan 102</input>
Switch1(config-vlan)#<input>name Students</input>
Switch1(config-vlan)#<input>^Z</input>
Switch1#<input>sh vlan brief</input>

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

Seeing the VLAN's in running config

vtp mode transparant

Adding VLAN's from database mode

You can add VLAN's from vlan database

Switch1#<input>vlan database</input>
% 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)#<input>vlan 100 name Admin</input>
VLAN 100 added:
    Name: Admin
Switch1(vlan)#<input>vlan 101 name Sales</input>
VLAN 101 added:
    Name: Sales
Switch1(vlan)#<input>vlan 102 name Students</input>
VLAN 102 added:
    Name: Students
Switch1(vlan)#<input>exit</input>
APPLY completed.
Exiting....
Switch1#<input>sh vlan brief</input>

LAN 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#<input>conf t</input>
Enter configuration commands, one per line.  End with CNTL/Z.
Switch1(config)#<input>interface fastethernet 0/7</input>
Switch1(config-if)#<input>switchport mode access</input>
Switch1(config-if)#<input>switchport access vlan 102</input>

Adding a range of ports to a VLAN

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

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

To view ports in VLAN Students

Switch1#<input>show vlan name Students</input>

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
------- --------- ----------------- ------------------------------------------