首頁 > 通信技術 > 交換技術 >

cisco三層交換機設置實現vlan間的通訊
2016-03-29 15:17:26 來源: 評論:0 點擊:
VLAN與網絡中唯一的IP子網相關聯,VLAN中的每個設備配置一個相同網段的IP地址,不同的VLAN使用不同網段的IP地址。這種子網VLAN關聯簡化了多VLAN環境中的路由 處理。三層交換機屬于三層設備,因此,它是實現VLAN間設備通信的良好選擇。
為了使第三層交換機執行路由功能,交換機上的VLAN接口需配置合適的IP地址,該地址就是VLAN中主機的網關地址。
下面通過一個實例來看三層交換機如何實現VLAN間路由。
下圖所示是一個校園網的網絡拓撲,要求所有計算機能夠通過域名ncxyol.com訪問web服務器,并且不同VLAN間的計算機可以相互通信。
VLAN劃分如下:VLAN10:
PC1:192.168.1.1
PC2:192.168.1.2
PC3:192.168.1.3
默認網關:192.168.1.254
DNSserver:192.168.40.1
VLAN20:
PC1:192.168.2.1
PC2:192.168.2.2
PC3:192.168.2.3
默認網關:192.168.2.254
DNSserver:192.168.40.1
VLAN30:
PC1:192.168.3.1
PC2:192.168.3.2
交換機配置如下:PC3:192.168.3.3
默認網關:192.168.3.254
DNSserver:192.168.40.1
VLAN40:
DNS服務器:192.168.40.1
在DNS服務器上添加一A條記錄即web服務器的域名解析:ncxyol.com 192.168.40.2
Web服務器:192.168.40.2
默認網關:192.168.40.254
按照如上方法配置成功以后,在SW1(三層交換機)上 show ip route 會發先四個直連路由:SW1(三層交換機)
en
config t
vtp mode server
vtp domain jxdy
vlan 10
name jxdy1
vlan 20
name jxdy2
vlan 30
name jxdy3
vlan 40
name jxdy4
int range f0/22 - 24
sw mode trunk
no sh
int range f0/1 - 2
swit mode acc
sw acc vlan 40
no shut
int vlan 10
ip add 192.168.1.254 255.255.255.0
no shut
int vlan 20
ip add 192.168.2.254 255.255.255.0
no shut
int vlan 30
ip add 192.168.3.254 255.255.255.0
no shut
int vlan 40
ip add 192.168.40.254 255.255.255.0
no shut
SW2
en
config t
vtp mode cli
vtp domain jxdy
int f0/24
swit mod trunk
no sh
exit
int f0/1
swit mode acc
swit acc vlan 10
no shut
int f0/2
swit mode acc
swit acc vlan 20
no shut
int f0/3
swit mode acc
swit acc vlan 30
no shut
SW3
en
config t
vtp mode cli
vtp domain jxdy
int f0/24
swit mod trunk
no sh
exit
int f0/1
swit mode acc
swit acc vlan 10
no shut
int f0/2
swit mode acc
swit acc vlan 20
no shut
int f0/3
swit mode acc
swit acc vlan 30
no shut
SW4
en
config t
vtp mode cli
vtp domain jxdy
int f0/24
swit mod trunk
no sh
exit
int f0/1
swit mode acc
swit acc vlan 10
no shut
int f0/2
swit mode acc
swit acc vlan 20
no shut
int f0/3
swit mode acc
swit acc vlan 30
no shut
Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, Vlan10
C 192.168.2.0/24 is directly connected, Vlan20
C 192.168.3.0/24 is directly connected, Vlan30
C 192.168.40.0/24 is directly connected, Vlan40
配置就緒以后測試就會發現不同VLAN間可以通信了。
詳細實驗見附件。http://txwh123.com/index.php?m=content&c=index&a=show&catid=15&id=355
上一篇:華為交換機的RRPP配置實驗是什么?RRPP配置實驗教程
下一篇:交換機三種端口模式Access、Hybrid和Trunk的理解
評論排行
- ·中國移動2G退網的可能性有多大?(1)