目錄
??配置管理IP地址
??配置VTY密碼
??配置默認網關
??虛擬局域網(VLAN)
??VLAN的概念
??VLAN范圍
??VLAN基本配置
??創(chuàng)建VLAN
??刪除VLAN
??查看VLAN信息
??vlan配置實例
??VLAN Trunk
??Trunk概述
??VLAN的標識
??Trunk的配置
??Trunk拓展
? ? ??博客主頁:大蝦好吃嗎的博客
? ? ??專欄地址:網絡專欄
????????所有配置都在本地管理十分不方便,而且有些機房不能輕易進入,這是就需要借用Telnet協(xié)議對交換機進行遠程管理。
配置管理IP地址
????????路由器是三層設備,可以直接在接口上配置ip地址,所以直接使用接口地址作為管理ip地址即可。對于交換機而言,必須配置管理IP地址。
????????實現遠程管理的條件:配置管理IP地址;配置VTP密碼。
交換機配置管理IP地址如下:
Switch(config)#int vlan 1
Switch(config-if)#ip address 192.168.8.1 255.255.255.0
Switch(config-if)#no sh
配置VTY密碼
????????遠程telnet登錄一臺設備時,可以通過VTY密碼作為驗證。和前面的console口配置密碼有些相似,0 4 分別表示允許同時進入VTY0、VTY1、VTY2、VTY3、VTY4這五個虛擬端口。
Switch(config)#line vty 0 4
Switch(config-line)#password 123
Switch(config-line)#login
使用PC機測試,查看下圖打開CMD窗口,輸入下面命令。
?
????????連接時輸入en后并沒有進入特權模式,這是因為遠程訪問交換機時必須配置特權模式密碼。下面打開交換機配置上密文密碼后在重新嘗試。
Switch(config)#enable secret 123
配置密碼后再次嘗試,登錄進入特權模式,結果顯而易見,成功進入
Switch>
Switch>en
Password:
Switch#
配置默認網關
????????如果管理員主機與要管理的交換機不在同一網段,就必須給該交換機指定默認網關,否則無法實現遠程登錄。
?
????????通過上圖可以看到,PC機管理同一網段的話,正常配置VTY即可,而SW2不在同一網段,想要對SW2進行遠程連接,需要配置默認網關,配置如下:
sw2(config)#ip default-gateway 2.0.0.2
虛擬局域網(VLAN)
VLAN的概念
分隔廣播域的方法有兩種:物理分隔(設備);邏輯分隔(VLAN)。
VLAN的優(yōu)點:控制廣播;增強網絡安全性;簡化網絡管理。
VLAN的種類:靜態(tài)VLAN:也稱為基于端口的VLAN,是目前最常見的VLAN實現方式。
動態(tài)VLAN:目前最普遍的實現方法是基于MAC地址的動態(tài)VLAN。
VLAN范圍
VLAN的ID范圍 | 范圍 | 用途 |
---|---|---|
0、4095 | 保留 | 僅限系統(tǒng)使用,用戶不能查看和使用這些vlan |
1 | 正常 | cisco默認的vlan,用戶能夠使用該vlan,但是不能刪除它 |
2~1001 | 正常 | 用于以太網的vlan,用戶可以創(chuàng)建、使用和刪除這些vlan |
1002~1005 | 正常 | 用于FDDI和令牌環(huán)的cisco默認vlan,用戶不能刪除這些vlan |
1006~1024 | 保留 | 僅限系統(tǒng)使用,用戶不能查看和使用這些vlan |
1025~4094 | 擴展 | 僅用于以太網vlan |
VLAN基本配置
配置VLAN的步驟如下:
1.創(chuàng)建VLAN
2.將交換機的端口加入相應的VLAN中
3.驗證VLAN的配置
創(chuàng)建VLAN
可以在兩種模式下配置VLAN,先看第一種。
????????VLAN數據庫配置模式,此模式支持VLAN正常范圍(1~1005)
Switch#vlan database #進入VLAN數據庫
Switch(vlan)#vlan 10 name test1 #創(chuàng)建vlan10,名稱test1
VLAN 10 added:
? Name: test1
Switch(vlan)#exit #保存退出
APPLY completed.
Exiting....
????????全局配置模式,此模式不僅支持VLAN正常范圍,還可以配置VLAN數據庫不能配置的擴展范圍VLAN。
Switch(config)#vlan 20 #創(chuàng)建vlan20
Switch(config-vlan)#name test2 #指定名稱test2
Switch(config-vlan)#exit #保存退出
刪除VLAN
????????刪除vlan的方法同樣有兩種,分別實在vlan數據庫中和全局模式中。
全局模式中刪除vlan
Switch(config)#no vlan 10
vlan數據庫中刪除
Switch#vlan database
Switch(vlan)#no vlan 20
Switch(vlan)#exit
將交換機的端口加入vlan
Switch#conf t #進入配置狀態(tài)
Switch(config)#vlan 10 #創(chuàng)建vlan(有的話不用創(chuàng)建)
Switch(config-vlan)#exit #保存退出
Switch(config)#int f0/1 #進入分配的接口
Switch(config-if)#switchport mode access #定義二層端口模式
Switch(config-if)#switchport access vlan 10 #把端口分配給指定vlan
Switch(config-if)#exit #退出
查看VLAN信息
Switch#show vlan brief
查看指定vlan信息
Switch#show vlan id 10
vlan配置實例
????????在一臺交換機上創(chuàng)建VLAN10、20、30,將VLAN30命名為caiwu,并將端口5~10添加到vlan10中,將交換機的端口11~15添加到vlan20中,將交換機的端口16~20添加到vlan30中。
1、創(chuàng)建vlan
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#exit
Switch(config)#vlan 30
Switch(config-vlan)#name caiwu
Switch(config-vlan)#exit
2、分配vlan10,range表示進入多個接口。
Switch(config)#int range f0/5 - 10
Switch(config-if-range)#switchport mode access
Switch(config-if-range)#switchport access vlan 10
Switch(config-if-range)#exit
3、分配vlan20,后面配置將逐步簡寫,語法全拼和第二步一樣
Switch(config)#int range f0/11 -15
Switch(config-if-range)#sw mode acc
Switch(config-if-range)#sw acc vlan 20
Switch(config-if-range)#exit
4、分配vlan30
Switch(config)#int r f0/16 - 20
Switch(config-if-range)#sw m a
Switch(config-if-range)#sw a v 30
Switch(config-if-range)#end
5、查看VLAN信息
Switch#show vlan brief
?
VLAN Name ? ? ? ? ? ? ? ? ? ? ? ? ? ? Status ? Ports
---- -------------------------------- --------- -------------------------------
1 ? default ? ? ? ? ? ? ? ? ? ? ? ? active ? Fa0/1, Fa0/2, Fa0/3, Fa0/4
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Fa0/21, Fa0/22, Fa0/23, Fa0/24
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Gig0/1, Gig0/2
10 ? VLAN0010 ? ? ? ? ? ? ? ? ? ? ? ? active ? Fa0/5, Fa0/6, Fa0/7, Fa0/8
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Fa0/9, Fa0/10
20 ? VLAN0020 ? ? ? ? ? ? ? ? ? ? ? ? active ? Fa0/11, Fa0/12, Fa0/13, Fa0/14
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Fa0/15
30 ? caiwu ? ? ? ? ? ? ? ? ? ? ? ? ? active ? Fa0/16, Fa0/17, Fa0/18, Fa0/19
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Fa0/20
1002 fddi-default ? ? ? ? ? ? ? ? ? ? active ? ?
1003 token-ring-default ? ? ? ? ? ? ? active ? ?
1004 fddinet-default ? ? ? ? ? ? ? ? active ? ?
1005 trnet-default ? ? ? ? ? ? ? ? ? active ? ?
VLAN Trunk
????????當網絡中有多臺交換機時,位于不同交換機上的相同vlan的主機之間是如何通信的呢?下面將解決這個問題,即跨交換機的vlan通信。
Trunk概述
????????如果每個vlan都連接一條物理鏈路,那么兩臺交換機之間將會有多條線路,Trunk的作用就是把一條線路分成多個邏輯鏈路,以至于多vlan之間可以通信。
交換網絡中,有兩種鏈路類型,接入鏈路和中繼鏈路。
接入鏈路:通常屬于一個vlan。
中繼鏈路:可以承載多個vlan。
VLAN的標識
ISL:cisco私有的標識方法。
IEEE 802.1q:公有標識方法,其他廠商產品也支持這種標識方法。
Trunk的配置
????????根據拓撲圖搭建網絡,兩臺交換機分別劃分出三個vlan,配置ip后默認是可以互相通信的,配置好vlan后還可以通信嗎?但是我們的目的是什么?最終結果是可以同vlan之間通信,不同vlan之間不可通信。
?
????????配置思路:先創(chuàng)建vlan,指定PC機連接口指定模式為access并指定vlan,交換機與交換機之間配置Trunk線路。
SW1配置命令如下
Switch>en
Switch#conf t
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#sw m a
Switch(config-if)#sw a v 10
Switch(config-if)#int f0/2
Switch(config-if)#sw m a
Switch(config-if)#sw a v 20
Switch(config-if)#int f0/3
Switch(config-if)#sw m a
Switch(config-if)#sw a v 30
Switch(config-if)#int f0/4
Switch(config-if)#sw m t
SW2配置命令如下
Switch>en
Switch#conf t
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#exit
Switch(config)#int f0/1
Switch(config-if)#sw m a
Switch(config-if)#sw a v 10
Switch(config-if)#int f0/2
Switch(config-if)#sw m a
Switch(config-if)#sw a v 20
Switch(config-if)#int f0/3
Switch(config-if)#sw m a
Switch(config-if)#sw a v 30
Switch(config-if)#int f0/4
Switch(config-if)#sw m t
查看交換機
Switch#show int f0/4 switchport
Name: Fa0/4
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: On
Access Mode VLAN: 1 (default)
Trunking Native Mode VLAN: 1 (default)
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 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
Appliance trust: none
????????現在六臺PC機,通vlan之間是可以相互通信的,不同vlan之間無法通信,如果不需要在Trunk上傳輸vlan10的數據,可以移除。最后測試vlan10之間是否可以通信,通信失敗則表示刪除成功。
Switch(config)#int f0/4
Switch(config-if)#switchport trunk allowed vlan remove 10
Trunk拓展
access鏈路:鏈路對應的接口必須加入某一vlan,對交換機而言,該接口只允許有一個vlan流量通行。
trunk鏈路:鏈路兩端的接口配置為trunk或協(xié)商成功的一種鏈路,該鏈路默認情況下允許所有vlan同行,而且對每個vlan通過打不同的標識,主要用于連接交換機設備。
trunk鏈路必備的條件如下:
封裝:鏈路兩端借口的trunk封裝必須一致。
模式:鏈路兩端接口的trunk模式必須匹配。
Native vlan:鏈路兩端接口的Native vlan配置(802.1q封裝)相同。
接口模式文章來源:http://www.zghlxwxcb.cn/news/detail-467532.html
????????查詢指定接口的trunk配置show int int-id trunk,查詢該交換機所有的trunk接口配置show int trunk文章來源地址http://www.zghlxwxcb.cn/news/detail-467532.html
Switch#show int trunk
Port ? ? ? Mode ? ? ? ? Encapsulation Status ? ? ? Native vlan
Fa0/4 ? ? ? on ? ? ? ? ? 802.1q ? ? ? ? trunking ? ? 1
?
Port ? ? ? Vlans allowed on trunk
Fa0/4 ? ? ? 1-9,11-1005
?
Port ? ? ? Vlans allowed and active in management domain
Fa0/4 ? ? ? 1,20,30
?
Port ? ? ? Vlans in spanning tree forwarding state and not pruned
Fa0/4 ? ? ? 1,20,30
到了這里,關于【網絡】· 路由交換設備遠程管理,以及VLAN的配置的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!