VLAN交换机多拨之思科交换机配置脚本(注意TRUNK口对NATVE VLAN处理)
目的:多条ADSL分别接入1到23口,24口连接routeros。
1到23口分别属于vlan1到vlan23,24口做trunk。
交换机型号:CISCO WS-C2950-24
其他型号思科交换机,一般也可直接使用下面的配置。
配置:
enable
config terminterface fastEthernet 0/1
switchport access vlan 1
switchport mode access
no shutdown
interface fastEthernet 0/2
switchport access vlan 2
switchport mode access
no shutdown
interface fastEthernet 0/3
switchport access vlan 3
switchport mode access
no shutdown
interface fastEthernet 0/4
switchport access vlan 4
switchport mode access
no shutdown
interface fastEthernet 0/5
switchport access vlan 5
switchport mode access
no shutdown
interface fastEthernet 0/6
switchport access vlan 6
switchport mode access
no shutdown
interface fastEthernet 0/7
switchport access vlan 7
switchport mode access
no shutdown
interface fastEthernet 0/8
switchport access vlan 8
switchport mode access
no shutdown
interface fastEthernet 0/9
switchport access vlan 9
switchport mode access
no shutdown
interface fastEthernet 0/10
switchport access vlan 10
switchport mode access
no shutdown
interface fastEthernet 0/11
switchport access vlan 11
switchport mode access
no shutdown
interface fastEthernet 0/12
switchport access vlan 12
switchport mode access
no shutdown
interface fastEthernet 0/13
switchport access vlan 13
switchport mode access
no shutdown
interface fastEthernet 0/14
switchport access vlan 14
switchport mode access
no shutdown
interface fastEthernet 0/15
switchport access vlan 15
switchport mode access
no shutdown
interface fastEthernet 0/16
switchport access vlan 16
switchport mode access
no shutdown
interface fastEthernet 0/17
switchport access vlan 17
switchport mode access
no shutdown
interface fastEthernet 0/18
switchport access vlan 18
switchport mode access
no shutdown
interface fastEthernet 0/19
switchport access vlan 19
switchport mode access
no shutdown
interface fastEthernet 0/20
switchport access vlan 20
switchport mode access
no shutdown
interface fastEthernet 0/21
switchport access vlan 21
switchport mode access
no shutdown
interface fastEthernet 0/22
switchport access vlan 22
switchport mode access
no shutdown
interface fastEthernet 0/23
switchport access vlan 23
switchport mode access
no shutdown
interface fastEthernet 0/24
switchport mode trunk
switchport trunk native vlan 99
switchport trunk allowed vlan 1-23
no shutdown
end
copy run start
是不是比其他品牌的交换机配置都简单,几秒种就搞定了。
注意:trunk口要配置switchport trunk native vlan 99,要不然vlan1出来的数据将不带tag(如果这样ros在vlan1上不能拨号)。如果你不想改TRUNK口的NATIVE VLAN,也可改接口1的VLAN,但这样接口1的接口号和VLAN号就不统一了。
评论: