Cisco 的基本配置實例之四----vlan的規划及配置(接入交換機)


4.2 接入交換機的相關配置

## 在此例中,我們聯入的是一台接入交換機,此交換機的gi0/1口上聯至核心交換機。也就意味着我們需要配置gi0/1為trunk口。具體的配置如下:

D-2960-3(config)#int gi0/1

D-2960-3(config-if)#switchport mode trunk      

## 配置此接口的模式為trunk,在cisoc2960交換機中,配置完接口模式為trunk后就可以了,不需要進一步配置此trunk口的封裝狀態,因為其默認的也是唯一的封裝類型就是dot1q,並且此系列交換機並沒有專門的封裝配置命令。

 D-2960-3(config-if)#exit

D-2960-3(config)#exit

D-2960-3#sh int tru                     # 退至特權配置模式驗證一下剛才的配置

 

Port        Mode         Encapsulation  Status        Native vlan

Gi0/1       auto         802.1q         trunking      1                   

# 這個端口已經配置成trunk模式,並且封裝成802.1q了

Port        Vlans allowed on trunk

Gi0/1       1-4094

 

Port        Vlans allowed and active in management domain

Gi0/1       1-2,10,20,30,40,50,60,70,80,100,110,120,150,160

 

Port        Vlans in spanning tree forwarding state and not pruned

Gi0/1       1-2,10,20,30,40,50,60,70,80,100,110,120,150,160

 

D-2960-3#conf t                                                     # 進入到全局配置模式

 

D-2960-3(config)#vtp mode client            

# 配置vtp模式為client,與核心交換機的server模式相呼應。

D-2960-3(config)#vtp domain pjoe            

# 配置vtp域為pjoe,只有一個域中的交換機才能互傳vlan信息。

D-2960-3(config)#vtp password pjoeserver                # 配置vtp密碼

D-2960-3(config)#end

 

D-2960-3#sh vtp status                              # 退出到特權模式驗證一下剛才的有關vtp的配置

VTP Version                       : 2

Configuration Revision                : 23

Maximum VLANs supported locally    : 255

Number of existing VLANs           : 19

VTP Operating Mode              : Client            # 模式已經設置成client

VTP Domain Name                 : pjoe             # 域名已經設置成pjoe

VTP Pruning Mode                : Disabled

VTP V2 Mode                     : Disabled

VTP Traps Generation                : Disabled

MD5 digest                      : 0xEC 0x30 0xEF 0x6F 0xA5 0x9A 0x39 0x7B

# 密碼已經配置完畢,但是被加密顯示了

Configuration last modified by 192.168.113.254 at 12-3-07 22:58:54

 

##稍等一會后,驗證一下是否學習到了核心交換機的vlan信息,它的學習有一小段的過程30秒的樣子。

 

D-2960-3#sh vlan                                                    # 驗證一下vlan信息是否全部學到。

 

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, Fa0/25, Fa0/26, Fa0/27, Fa0/28, Fa0/29, Fa0/30, Fa0/31,Fa0/32, Fa0/33, Fa0/34, Fa0/35, Fa0/36, Fa0/37, Fa0/38, Fa0/39, Fa0/40, Fa0/41,a0/42, Fa0/43, Fa0/44, Fa0/45, Fa0/46, Fa0/47, Fa0/48, Gi0/2

2    firewall                                active   

# ok,核心交換機上配置好的vlan信息已經被這台交換機學習到了,剩下的工作僅需要將相應的端口添加到相應的vlan中就可以了,此處不贅述。   

10   Engineering                            active     

20   Procurement                           active   

30   QAQC                             active   

40   Operation                             active   

50   Yard                                 active   

60   BM                                 active   

70   HRAD                             active   

80   Facility                                active   

100  Finance                               active   

110  GO                                 active   

120  Wlan                                active   

150  Server                                active   

160  Client                                 active   

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  

2    enet  100002     1500  -      -      -        -    -        0      0  

10   enet  100010     1500  -      -      -        -    -        0      0  

20   enet  100020     1500  -      -      -        -    -        0      0  

30   enet  100030     1500  -      -      -        -    -        0      0  

40   enet  100040     1500  -      -      -        -    -        0      0  

50   enet  100050     1500  -      -      -        -    -        0      0  

60   enet  100060     1500  -      -      -        -    -        0      0  

70   enet  100070     1500  -      -      -        -    -        0      0  

80   enet  100080     1500  -      -      -        -    -        0      0  

100  enet  100100     1500  -      -      -        -    -        0      0  

110  enet  100110     1500  -      -      -        -    -        0      0  

120  enet  100120     1500  -      -      -        -    -        0      0  

150  enet  100150     1500  -      -      -        -    -        0      0  

160  enet  100160     1500  -      -      -        -    -        0      0  

1002 fddi  101002     1500  -      -      -        -    -        0      0
View Code

 

D-2960-3#

# 配置這台交換機的管理IP

D-2960-3(config)#int vlan 1                                            # 管理ip地址我們配置在vlan1上

D-2960-3(config-if)#ip address 192.168.113.222 255.255.255.0 # 設置實際的ip地址

D-2960-3(config-if)#exit

D-2960-3(config)#ip default-gateway 192.168.113.254     # 設置這台交換機的網關,此地址即為核心交換機vlan1的地址。

 D-2960-3(config)#end

D-2960-3#sh run                  # 驗證一下完整的配置。

D-2960-3#sh run

 

Switch#
//為VLAN配置ip地址(就是默認網關)
Switch(config)#interface vlan 10
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan10, changed state to up
Switch(config-if)#ip address 192.168.1.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface vlan 20
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan20, changed state to up
Switch(config-if)#ip address 192.168.2.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit
Switch(config)#interface vlan 30
Switch(config-if)#
%LINK-5-CHANGED: Interface Vlan30, changed state to up
Switch(config-if)#ip address 192.168.3.1 255.255.255.0
Switch(config-if)#no shutdown
Switch(config-if)#exit

Building configuration...

 

Current configuration : 2087 bytes

!

version 12.2

no service pad

service timestamps debug uptime

service timestamps log uptime

service password-encryption

!

hostname D-2960-3

!

enable password 7 12090F18170805172924

!

no aaa new-model

system mtu routing 1500

ip subnet-zero

!

no file verify auto

spanning-tree mode pvst

spanning-tree extend system-id

!

vlan internal allocation policy ascending

!

interface FastEthernet0/1

!

interface FastEthernet0/2

!

interface FastEthernet0/3

!

(省略… …)

interface FastEthernet0/45

!

interface FastEthernet0/46

!

interface FastEthernet0/47

!

interface FastEthernet0/48

!

interface GigabitEthernet0/1

!

interface GigabitEthernet0/2

!

interface Vlan1

 ip address 192.168.113.222 255.255.255.0

 no ip route-cache

!

ip default-gateway 192.168.113.254

ip http server

!

control-plane

!

!

line con 0

 password 7 12090F18170805172924

line vty 0 4

 password 7 12090F18170805172924

 login

line vty 5 15

 login

!

end
View Code

 

D-2960-3#  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM