Basic configuration: cisco switch configuration vlan (2)

Source: Internet
Author: User
Tags cisco switch

VLAN settings on a layer-3 Switch

1) Method 1: General Configuration

 
 
  1. Switch# configure terminal  
  2.  
  3. Switch(config)# vlan 20  
  4.  
  5. Switch(config-vlan)# name test20  
  6.  
  7. Switch(config-vlan)#ip address 1.1.1.1 255.255.255.0  
  8.  
  9. Switch(config-vlan)# end 

Method 2: enable VLAN configuration:

 
 
  1. Switch # vlan database // enter the VLAN configuration status
  2.  
  3. Switch (vlan) # vlan 20 name test20 // Add the vlan id and VLAN name
  4.  
  5. Switch (vlan) # exit update the VLAN database and exit

2) allocate a port to a VLAN

 
 
  1. Switch # configure terminal
  2.  
  3. Switch (config) # interface fastethernet0/1
  4.  
  5. Switch (config-if) # switchport mode access // defines the working mode of the L2 port as the access mode
  6.  
  7. Switch (config-if) # switchport access vlan 2 // assign a port to a VLAN
  8.  
  9. Switch (config-if) # end
  10.  
  11. Switch #

3) Configure VLAN Trunks

 
 
  1. Switch # configure terminal
  2.  
  3. Switch (config) # interface fastethernet0/4
  4.  
  5. Switch (config-if) # switchport mode trunk
  6.  
  7. Switch (config-if) # switchport trunk encapsulation dot1q
  8.  
  9. Switch (config-if) # end
  10.  
  11. Appendix: switchport trunk encapsulation {isl | dot1q | negotiate} // configure trunk to encapsulate ISL or 802.1Q or automatically negotiate

Switchport mode {dynamic {auto | desirable} | trunk} is generally not used). Configure the layer-2 trunk mode. Dynamic auto-automatically negotiate whether it is a trunk; dynamic desirable-set the port to trunk if the peer port is trunk, desirable, or automatic mode; trunk-set the port to the forced trunk mode, regardless of whether the other port is trunk)

4) define the VLAN allowed by the trunk

 
 
  1. Switch (config) # interface fastethernet0/1
  2.  
  3. Switch (config-if) # switchport trunk allowed vlan remove 2 // configure the VLAN allowed by the trunk
  4.  
  5. Switch (config-if) # end
  6.  
  7. Appendix: switchport trunk allowed vlan {add | all | unique T | remove} vlan-list

5) Configure Native VLAN802.1q)

 
 
  1. Switch (config-if) # switchport trunk native vlan-num
  2.  
  3. // The trunk port that encapsulates 802.1q can accept tagged and unlabeled data streams. The switch transfers unlabeled data streams to the native vlan, by default, the native VLAN is VLAN 1. Use the no switchport trunk native vlan port configuration command to return to the default status.

6) configure a group of Ports

 
 
  1. 4006 # configure terminal
  2.  
  3. 4006 (config) # interface range fastethernet2/1-5
  4.  
  5. 4006 (config-if-range) # no shutdown
  6.  
  7. // Note: a space must be added between the port numbers. For example, interface range fastethernet 2/1-5 is valid, while interface range fastethernet 2/1-5 is invalid.
  8.  
  9. The following example shows how to configure groups with different port types using commas:
  10.  
  11. 4006 # configure terminal
  12.  
  13. 4006 (config) # interface range fastethernet2/1-3, gigabitethernet3/1-2
  14.  
  15. 4006 (config-if-range) # no shutdown

7) Other Common commands

 
 
  1. Duplex {auto | full | half}
  2.  
  3. // Set full or half duplex.
  4.  
  5. Speed {10 | 100 | 1000 | auto | nonegotiate}
  6.  
  7. // Note: 1000 only works on Gigabit ports. The GBIC module only works at 1000 Mbps. nonegotiate can only use 1000BASE-SX,-LX, and-zx gbic on these GBIC.
  8.  
  9. Copy running-config startup-config
  10.  
  11. // Save settings

8) Configure EtherChannel

Several Ethernet ports are bound to an independent Logical Link. For example, you can bind a 4006 vswitch to a maximum of eight compatible ports with the same speed on any 4006 module. Each Ethernet channel has a port-channel port number. To bind an Ethernet channel, a logical port-channel is generated. The configuration under the logical port may affect the physical port bound with it, however, the configuration of physical ports does not affect the configuration of logical ports.

1) layer-3 Ethernet channel logical port-channe) Configuration

 
 
  1. Switch # configure terminal
  2.  
  3. Switch (config) # interface port-channel 1 // create a logical port
  4.  
  5. Switch (config-if) # ip address 172.32.52.10 255.255.255.0
  6.  
  7. Switch (config-if) # end

2) layer-3 physical port configuration

 
 
  1. Switch # configure terminal
  2.  
  3. Switch (config) # interface range fastethernet 5/4-5 (Note: spaces are required)
  4.  
  5. Switch (config-if) # no switchport // change the port to a layer-3 Interface
  6.  
  7. Switch (config-if) # no ip address // confirm that the interface is not configured with an ip address
  8.  
  9. Switch (config-if) # channel-group 1 mode desirable
  10.  
  11. Switch (config-if) # end
  12.  
  13. Appendix: Switch (config-if) # channel-group port_channel_number mode {auto | desirable | on} // Add the physical port to an Ethernet channel and determine the PagP mode.

3) layer-2 Ethernet Channel Configuration

 
 
  1. Switch # configure terminal
  2.  
  3. Switch (config) # interface range fastethernet 5/6-7 (Note: spaces are required)
  4.  
  5. Switch (config-if-range) # channel-group 2 mode desirable
  6.  
  7. Switch (config-if-range) # end
  8.  
  9. Switch # show running-config interface port-channel 2
  10.  
  11. Building configuration...
  12.  
  13. Current configuration:
  14.  
  15. !
  16.  
  17. Interface Port-channel2
  18.  
  19. Switchport access vlan 10
  20.  
  21. Switchport mode access
  22.  
  23. End
  24.  
  25. Switch #

The configurations of VLAN on a layer-3 Switch have been described.

    1. Typical VLAN-VPN Configuration
    2. Typical configurations of multicast VLAN
    3. Port-based VLAN Configuration Guide
    4. Basic configuration: cisco switch configuration vlan1)
    5. Basic configuration: cisco switch configuration vlan2)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.