在一臺三層交換上,不同VLAN相互通信配置方法
發(fā)布時間:2012-09-20 16:24:23 作者:佚名
我要評論

因為市場部和人事部因為業(yè)務(wù)上的關(guān)系,需要兩臺服務(wù)器相互通信,所在還需要在3550上配置VLAN間相互通信
本實驗需求:
通過在cisco catalyst 3550來規(guī)劃VLAN 100 和VLAN 200,并且配置DHCP 讓VLAN100人事部計算機(jī)獲得IP地址為192.168.0.0/24,讓VLAN200市場部計算機(jī)獲得IP地址為172.16.0.0/24。因為市場部和人事部因為業(yè)務(wù)上的關(guān)系,需要兩臺服務(wù)器相互通信,所在還需要在3550上配置VLAN間相互通信。
實驗拓?fù)洌?
實驗過程 第一步 配置Catalyst 3550基礎(chǔ)配置
Switch>
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host 3550
3550(config)#no ip do lo
3550(config)#line con 0
3550(config-line)#no exec-t
3550(config-line)#logg syn
3550(config-line)#exit
第二步 在Catalyst 3550 劃分VLAN 100和VLAN 200 //進(jìn)入全局配置模式下,劃分VLAN(請問catalyst 3500支持在全局模式下劃分VLAN嗎?)
3550(config)#vlan 100
//給VLAN100命名
3550(config-vlan)#name renshibo
3550(config-vlan)#int f0/13
3550(config-if)#switchport mode access
3550(config-if)#switchport access vlan 100
3550(config-if)#spanning-tree portfast
//請問什么時候需要在交換機(jī)接口下配置portfast?這里如果不配置可以嗎?
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/13 but will only
have effect when the interface is in a non-trunking mode.
3550(config-if)#vlan 200
3550(config-vlan)#name shichangbo
3550(config-vlan)#int f0/15
3550(config-if)#sw mo acc
3550(config-if)#sw acc vlan 200
3550(config-if)#spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/15 but will only
have effect when the interface is in a non-trunking mode.
//驗證VLAN的配置
3550#show vlan brief
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/14, Fa0/16, Fa0/17, Fa0/18
Fa0/23, Gi0/1, Gi0/2
100 renshibo active Fa0/13
200 shichangbo active Fa0/15
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
第三步 配置SVI(交換虛擬接口)
3550#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//進(jìn)入VLAN 100 虛擬接口下
3550(config)#int vlan 100
//增加接口描述,以便將來排錯更加方便
3550(config-if)#description Connection to renshibo
//這里配置的IP地址就是人事部PC的默認(rèn)網(wǎng)關(guān)地址,如果VLAN接口不配置IP地址,后面的DHCP配置中,PC能否獲得IP地址嗎??
3550(config-if)#ip add 192.168.0.1 255.255.255.0
3550(config-if)#no sh
3550(config-if)#int vlan 200
00:13:22: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan200, changed state to up
3550(config-if)#description Connection to shichangbo
3550(config-if)#ip add 172.16.0.1 255.255.255.0
3550(config-if)#no sh
3550(config-if)#
3550#conf t
//開啟catalyst 3550三層交換路由功能(默認(rèn)是關(guān)閉的)
請問cisco catalyst那些型號交換機(jī)是三層交換機(jī)?
3550(config)#ip routing
3550(config)#exit
3550#sh ip route
//兩條直連路由條目
Codes: C - connected, S - static, 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, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, Vlan200
C 192.168.0.0/24 is directly connected, Vlan100
Designated bridge has priority 32768, address ccd1.0a80.0000
Designated port id is 129.65, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 993, received 92
第四步 在Catalyst 3550上配置DHCP,以便于VLAN100和VLAN200下客戶端獲得IP地址,掩碼,網(wǎng)關(guān),DNS等
//全局下打開DHCP服務(wù).默認(rèn)是開啟的嗎?那為什么還要需要開啟了?
3550(config)#service dhcp
//關(guān)閉dhcp 客戶端IP沖突日志記錄信息
3550(config)#no ip dhcp conflict logging
//配置地址池名稱,地址池名稱為任意字符(這里定義的名字VLAN的名稱)
3550(config)#ip dhcp pool renshibo
//配置PC所獲得網(wǎng)段地址范圍,和掩碼,(這里有幾種命令語句格式)
(network 192.168.0.0 255.255.255.0)
3550(dhcp-config)#network 192.168.0.0 /24
//配置網(wǎng)關(guān)地址
3550(dhcp-config)#default-router 192.168.0.1
//配置DNS(域名解析服務(wù)器)可選配置
請問什么時候PC需要配置DNS地址?局域網(wǎng)通訊需要嗎?
3550(dhcp-config)#dns 218.30.19.40 61.134.1.4
//配置域名
3550(dhcp-config)#domain-name www.cisco.com
//配置地址租期為永久
3550(dhcp-config)#lease infinite
3550(dhcp-config)#exit
//配置排除的IP地址范圍,不從地址池內(nèi)分配的地址,不配置排除地址可以嗎?
3550(config)#ip dhcp excluded-address 192.168.0.1
3550(config)#ip dhcp pool shichangbo
3550(dhcp-config)#network 172.16.0.0 /24
3550(dhcp-config)#default-router 172.16.0.1
3550(dhcp-config)#dns 218.30.19.40 61.134.1.4
3550(dhcp-config)#domain-name www.cisco.com
3550(dhcp-config)#lease infinite
3550(dhcp-config)#exit
3550(config)#ip dhcp excluded-address 172.16.0.1
第五步 在市場部PC上驗證是否能從catalyst 3550獲得IP地址, 如圖:開始-運(yùn)行-cmd-ipconfig /all
第六步 在Catalyst 3550查看PC獲得的IP地址是否正確
//查看DHCP綁定信息
3550#sh ip dhcp binding
IP address Client-ID/ (MAC地址) Lease expiration Type
Hardware address
172.16.0.2 0100.16d3.249f.fd Infinite Automatic
192.168.0.2 0100.1641.15e8.5c Infinite Automatic
第七步 在交換機(jī)測試是否可以ping通市場部和人事部PC
3550(config)#exit
3550#
00:26:41: %SYS-5-CONFIG_I: Configured from console by console
3550#ping 172.16.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
3550#ping 192.168.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
第八步 在市場部PC上用ping命令測試是否可以ping通VLAN100(人事部) 下PC 如圖:測試結(jié)果如下,可以ping通,實驗現(xiàn)象成功!
本文出自 “王萬利的博客” 博客
通過在cisco catalyst 3550來規(guī)劃VLAN 100 和VLAN 200,并且配置DHCP 讓VLAN100人事部計算機(jī)獲得IP地址為192.168.0.0/24,讓VLAN200市場部計算機(jī)獲得IP地址為172.16.0.0/24。因為市場部和人事部因為業(yè)務(wù)上的關(guān)系,需要兩臺服務(wù)器相互通信,所在還需要在3550上配置VLAN間相互通信。
實驗拓?fù)洌?

實驗過程 第一步 配置Catalyst 3550基礎(chǔ)配置
復(fù)制代碼
代碼如下:Switch>
Switch>enable
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#host 3550
3550(config)#no ip do lo
3550(config)#line con 0
3550(config-line)#no exec-t
3550(config-line)#logg syn
3550(config-line)#exit
第二步 在Catalyst 3550 劃分VLAN 100和VLAN 200 //進(jìn)入全局配置模式下,劃分VLAN(請問catalyst 3500支持在全局模式下劃分VLAN嗎?)
復(fù)制代碼
代碼如下:3550(config)#vlan 100
//給VLAN100命名
3550(config-vlan)#name renshibo
3550(config-vlan)#int f0/13
3550(config-if)#switchport mode access
3550(config-if)#switchport access vlan 100
3550(config-if)#spanning-tree portfast
//請問什么時候需要在交換機(jī)接口下配置portfast?這里如果不配置可以嗎?
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/13 but will only
have effect when the interface is in a non-trunking mode.
3550(config-if)#vlan 200
3550(config-vlan)#name shichangbo
3550(config-vlan)#int f0/15
3550(config-if)#sw mo acc
3550(config-if)#sw acc vlan 200
3550(config-if)#spanning-tree portfast
%Warning: portfast should only be enabled on ports connected to a single
host. Connecting hubs, concentrators, switches, bridges, etc... to this
interface when portfast is enabled, can cause temporary bridging loops.
Use with CAUTION
%Portfast has been configured on FastEthernet0/15 but will only
have effect when the interface is in a non-trunking mode.
//驗證VLAN的配置
3550#show vlan brief
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/14, Fa0/16, Fa0/17, Fa0/18
Fa0/23, Gi0/1, Gi0/2
100 renshibo active Fa0/13
200 shichangbo active Fa0/15
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
第三步 配置SVI(交換虛擬接口)
復(fù)制代碼
代碼如下:3550#conf t
Enter configuration commands, one per line. End with CNTL/Z.
//進(jìn)入VLAN 100 虛擬接口下
3550(config)#int vlan 100
//增加接口描述,以便將來排錯更加方便
3550(config-if)#description Connection to renshibo
//這里配置的IP地址就是人事部PC的默認(rèn)網(wǎng)關(guān)地址,如果VLAN接口不配置IP地址,后面的DHCP配置中,PC能否獲得IP地址嗎??
3550(config-if)#ip add 192.168.0.1 255.255.255.0
3550(config-if)#no sh
3550(config-if)#int vlan 200
00:13:22: %LINEPROTO-5-UPDOWN: Line protocol on Interface Vlan200, changed state to up
3550(config-if)#description Connection to shichangbo
3550(config-if)#ip add 172.16.0.1 255.255.255.0
3550(config-if)#no sh
3550(config-if)#
3550#conf t
//開啟catalyst 3550三層交換路由功能(默認(rèn)是關(guān)閉的)
請問cisco catalyst那些型號交換機(jī)是三層交換機(jī)?
3550(config)#ip routing
3550(config)#exit
3550#sh ip route
//兩條直連路由條目
Codes: C - connected, S - static, 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, su - IS-IS summary, 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
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, Vlan200
C 192.168.0.0/24 is directly connected, Vlan100
Designated bridge has priority 32768, address ccd1.0a80.0000
Designated port id is 129.65, designated path cost 0
Timers: message age 0, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 993, received 92
第四步 在Catalyst 3550上配置DHCP,以便于VLAN100和VLAN200下客戶端獲得IP地址,掩碼,網(wǎng)關(guān),DNS等
復(fù)制代碼
代碼如下://全局下打開DHCP服務(wù).默認(rèn)是開啟的嗎?那為什么還要需要開啟了?
3550(config)#service dhcp
//關(guān)閉dhcp 客戶端IP沖突日志記錄信息
3550(config)#no ip dhcp conflict logging
//配置地址池名稱,地址池名稱為任意字符(這里定義的名字VLAN的名稱)
3550(config)#ip dhcp pool renshibo
//配置PC所獲得網(wǎng)段地址范圍,和掩碼,(這里有幾種命令語句格式)
(network 192.168.0.0 255.255.255.0)
3550(dhcp-config)#network 192.168.0.0 /24
//配置網(wǎng)關(guān)地址
3550(dhcp-config)#default-router 192.168.0.1
//配置DNS(域名解析服務(wù)器)可選配置
請問什么時候PC需要配置DNS地址?局域網(wǎng)通訊需要嗎?
3550(dhcp-config)#dns 218.30.19.40 61.134.1.4
//配置域名
3550(dhcp-config)#domain-name www.cisco.com
//配置地址租期為永久
3550(dhcp-config)#lease infinite
3550(dhcp-config)#exit
//配置排除的IP地址范圍,不從地址池內(nèi)分配的地址,不配置排除地址可以嗎?
3550(config)#ip dhcp excluded-address 192.168.0.1
3550(config)#ip dhcp pool shichangbo
3550(dhcp-config)#network 172.16.0.0 /24
3550(dhcp-config)#default-router 172.16.0.1
3550(dhcp-config)#dns 218.30.19.40 61.134.1.4
3550(dhcp-config)#domain-name www.cisco.com
3550(dhcp-config)#lease infinite
3550(dhcp-config)#exit
3550(config)#ip dhcp excluded-address 172.16.0.1
第五步 在市場部PC上驗證是否能從catalyst 3550獲得IP地址, 如圖:開始-運(yùn)行-cmd-ipconfig /all

第六步 在Catalyst 3550查看PC獲得的IP地址是否正確
復(fù)制代碼
代碼如下://查看DHCP綁定信息
3550#sh ip dhcp binding
IP address Client-ID/ (MAC地址) Lease expiration Type
Hardware address
172.16.0.2 0100.16d3.249f.fd Infinite Automatic
192.168.0.2 0100.1641.15e8.5c Infinite Automatic
第七步 在交換機(jī)測試是否可以ping通市場部和人事部PC
復(fù)制代碼
代碼如下:3550(config)#exit
3550#
00:26:41: %SYS-5-CONFIG_I: Configured from console by console
3550#ping 172.16.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms
3550#ping 192.168.0.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/4 ms
第八步 在市場部PC上用ping命令測試是否可以ping通VLAN100(人事部) 下PC 如圖:測試結(jié)果如下,可以ping通,實驗現(xiàn)象成功!

本文出自 “王萬利的博客” 博客
相關(guān)文章
- 通過在SW100 來創(chuàng)建VLAN 100 ,sw2 上創(chuàng)建VLAN 200,因為VLAN100和VLAN200因為業(yè)務(wù)上的關(guān)系,需要兩臺PC之間相互通信,保證不同VLAN之間可以互相訪問。 本實驗將給您詳細(xì)闡2012-09-20
- 這篇文章主要介紹了圖解TCP通信三次握手和四次分手,對正在學(xué)習(xí)TPC通信的同學(xué)會有些幫助,需要的朋友可以參考下2014-09-24
SDN與交換機(jī)怎么實現(xiàn)通信 需達(dá)成什么“協(xié)議”
怎樣實現(xiàn)SDN與交換機(jī)通信?為了解決這個問題,目前有許多供應(yīng)商正在開發(fā)開放傳輸交換機(jī),它們將充當(dāng)SDN控制器和光纖傳輸交換機(jī)之間的中介,需要的朋友可以參考下2014-09-16華為交換機(jī)怎么配置Trunk接口實現(xiàn)通信?
華為交換機(jī)怎么配置Trunk接口實現(xiàn)通信?交換機(jī)不配置置Trunk接口VLAN之間的數(shù)據(jù)是不能互通的,Trunk接口能收到所有VLAN的廣播包信息,但是怎么配置Trunk接口?請看下文詳細(xì)2015-12-11- 家里的無線密碼忘記了,自己也無法登錄了,那如何修改無線密碼呢?2013-05-17
磊科的無線路由器密碼怎么設(shè)置 密碼設(shè)置方法圖文介紹
磊科無線路由器設(shè)置還是比較簡單的,相信新手看了這圖文教程也應(yīng)該馬上就會說原來這么簡單,沒做之前覺得很難。其他的路由器設(shè)置也類似,都是比較簡單的。現(xiàn)在都越來越傻瓜2014-04-03無線路由器怎么限制別人網(wǎng)速 用路由器控制別人網(wǎng)速圖文教程
無線路由器怎么限制別人網(wǎng)速,相信這是很多都想知道吧。用同一個路由器,難免就會出現(xiàn)有人看電影占網(wǎng)速的情況,對自己的網(wǎng)速造成很大的影響。今天腳本之家就教大家用路由器2014-07-15- 家里有一臺臺式電腦是有線上網(wǎng)的,現(xiàn)在自己買了一臺筆記本和無線路由器,想實現(xiàn)筆記本練級無線路由器無線上網(wǎng),但不知道如何操作,因此求助大俠幫忙指點下實現(xiàn)方法。2012-10-24
- 隨著現(xiàn)在智能化的普及應(yīng)用,尤其是在智能家庭方面,無線通信技術(shù)起著非常重要的作用, EnOcean、Zigbee,Z-Wave和Bluetooth(藍(lán)牙)是當(dāng)前連接智能家居產(chǎn)品的主要手段2016-05-31