In-depth analysis of Cisco switch configuration Vlan

Source: Internet
Author: User
Tags cisco switch
* Vlan configuration ideas (access and Trunk) (1) create a Vlan and configure a static VLAN on an IOS-based switch: switch # vlandatabaseswitch (vlan) # vlanvlan-numnamevlan-nameswitch (vlan) # exitswitch # configureteriminalswitch (config) # interfaceinterfacemodulenu

* Vlan configuration ideas (access and Trunk) (1) create a Vlan and configure a static VLAN on the IOS-based switch: switch # vlan database switch (vlan) # vlan-num name vlan-name switch (vlan) # exit switch # configure teriminal switch (config) # interface module/nu

* Vlan configuration ideas (access and Trunk)

(1) create a Vlan

Configure static VLAN on an IOS-based switch:

Switch # vlan database

Switch (vlan) # vlan-num name vlan-name

Switch (vlan) # exit

Switch # configure teriminal

Switch (config) # interface module/number

Switch (config-if) # switchport mode access // set the port mode to access

Switch (config-if) # switchport access vlan-num // set the vlan to which the port belongs

Switch (config-if) # end

Verify Configuration: show vlan

(2) Configure trunk links

The trunk is a point-to-point link between two catalyst Switch ports or between the catalyst Switch and the router. Trunk links can carry multiple VLANs.

Configure trunk links on IOS-based switches

Switch (config) # interface mod/port

Switch (config-if) # switchport mode trunk // you can specify trunk as the port mode.

Switch (config-if) # switchport trunk encapsulation {isl dotlq} // set the frame encapsulated by trunk

Switch (config-if) # switchport trunk allowed vlan remove vlan-list // allow those VLANs to pass through trunk

(Appendix: switchport trunk allowed vlan {add all outer t remove} vlan-list)

* No switchport

No switchport // The physical port is changed to a layer-3 Port, that is, the layer-3 port is used as the port on the router. After a port is configured as a layer-3 Port, an IP address can be allocated to the port, of course, you can still connect to a PC ,. Router port: A physical port is a port generated by the no switchport command in the port configuration status. IP addresses are required for all layer-3 routing ports for Route exchange.

Configuration example:

Switch # configure terminal

Switch (config) # interface gigabitethernet0/2

Switch (config-if) # no switchport

Switch (config-if) # ip address 192.20.135.21 255.255.255.0

Switch (config-if) # no shutdown

Switch (config-if) # end

Appendix: show interfaces [interface-id] switchport // display the status of the L2 port, which can be used to determine whether the port is a L2 or L3 port. Eg: Switch # show interfaces fastethernet 0/1 switchport

* VLAN settings on a layer-3 Switch

(1) Method 1: General Configuration

Switch # configure terminal

Switch (config) # vlan 20

Switch (config-vlan) # name test20

Switch (config-vlan) # ip address 1.1.1.1 255.255.255.0

Switch (config-vlan) # end

Method 2: enable VLAN configuration:

Switch # vlan database // enter the VLAN configuration status

Switch (vlan) # vlan 20 name test20 // Add the vlan id and VLAN name

Switch (vlan) # exit update the VLAN database and exit

(2) allocate a port to a VLAN

Switch # configure terminal

Switch (config) # interface fastethernet0/1

Switch (config-if) # switchport mode access // defines the working mode of the L2 port as the access mode

Switch (config-if) # switchport access vlan 2 // assign a port to a VLAN

Switch (config-if) # end

Switch #

(3) Configure VLAN Trunks

Switch # configure terminal

Switch (config) # interface fastethernet0/4

Switch (config-if) # switchport mode trunk

Switch (config-if) # switchport trunk encapsulation dot1q

Switch (config-if) # end

Appendix: switchport trunk encapsulation {isl dot1q negotiate} // configure trunk to encapsulate ISL or 802.1Q or automatically negotiate

Switchport mode {dynamic {auto desirable} trunk} (usually 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

Switch (config) # interface fastethernet0/1

Switch (config-if) # switchport trunk allowed vlan remove 2 // configure the VLAN allowed by the trunk

Switch (config-if) # end

Appendix: switchport trunk allowed vlan {add all subnet t remove} vlan-list

(5) Configure Native VLAN (802.1q)

Switch (config-if) # switchport trunk native vlan-num // The trunk port that encapsulates 802.1q can accept data streams with or without tags, A vswitch transmits 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

4006 # configure terminal

4006 (config) # interface range fastethernet2/1-5

4006 (config-if-range) # no shutdown

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

The following example shows how to configure groups with different port types using commas:

4006 # configure terminal

4006 (config) # interface range fastethernet2/1-3, gigabitethernet3/1-2

4006 (config-if-range) # no shutdown

(7) Other Common commands

Duplex {auto full half} // set full or half duplex.

Speed {10 100 1000 auto nonegotiate} sets the port speed // 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.

Copy running-config startup-config // 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

Switch # configure terminal

Switch (config) # interface port-channel 1 // create a logical port

Switch (config-if) # ip address 172.32.52.10 255.255.255.0

Switch (config-if) # end

2) layer-3 physical port configuration

Switch # configure terminal

Switch (config) # interface range fastethernet 5/4-5 (Note: spaces are required)

Switch (config-if) # no switchport // change the port to a layer-3 Interface

Switch (config-if) # no ip address // confirm that the interface is not configured with an ip address

Switch (config-if) # channel-group 1 mode desirable

Switch (config-if) # end

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

Switch # configure terminal

Switch (config) # interface range fastethernet 5/6-7 (Note: spaces are required)

Switch (config-if-range) # channel-group 2 mode desirable

Switch (config-if-range) # end

Switch # show running-config interface port-channel 2

Building configuration...

Current configuration:

!

Interface Port-channel2

Switchport access vlan 10

Switchport mode access

End

Switch #

* How to implement port Aggregation

If you want to configure a Trunk connection between two 6509 sets, First connect the second 6509 with a gigabit optical fiber, and then configure the trunk of the two connected ports separately, you can use only one pair of optical fiber, or use two pairs of Optical Fiber port channels. The configuration is as follows:

When one pair of optical fiber cables are connected, the following configurations are performed on two 65 optical fiber cables:

Interface GigabitEthernet1/1

No ip address

Switchport

Switchport trunk encapsulation dot1q

Switchport trunk native vlan 1

When connecting two pairs of optical fiber cables, you must configure port Channels on two 65 pairs respectively:

Interface port-channe1

No ip address

Switchport

Switchport trunk encapsulation dot1q

Switchport trunk native vlan 1

!

Interface GigabitEthernet1/1

No ip address

Duplex full

Speed1000

Switchport mode trunk

Switchport trunk encapsulation dot1q

Switchport trunk native vlan 1

Channel-group 1 mode on

!

Interface GigabitEthernet1/2

No ip address

Duplex full

Speed1000

Switchport mode trunk

Switchport trunk encapsulation dot1q

Switchport trunk native vlan 1

Channel-group 1 mode on

* VTP Cropping

(1) configure the VTP mode on the IOS-based switch:

Switch # vlan database

Switch (vlan) # vtp domain-name

Switch (vlan) # vtp {sever cilent transparent}

Switch (vlan) # vtp password

Configure the VTP mode on a CLI-based switch:

Switch (enable) set vtp [domain-name] [mode {sever cilent transparent}] [password]

(2) configure the VTP version on the IOS-based switch:

Switch # vlan database

Switch (vlan) # vtp v2-mode

Configure the VTP version on the CLI-based switch:

Switch (enable) set vtp v2 enable

(3) Enable VTP tailoring on IOS-based switches:

Switch # vlan database

Switch (vlan) # vtp pruning

Start VTP tailoring on a CLI-based switch:

Switch (enable) set vtp pruning enable

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.