1. 程式人生 > >【實驗】綜合實驗-哢哢哢還是一頓整

【實驗】綜合實驗-哢哢哢還是一頓整

trunk str 配置 dba 分段 exit 三層 地址 routing

實驗名稱:哢哢哢還是一頓整
實驗目的:
1.實現各VLAN間彼此通信
2.各VLAN的PC主機通過各自的DHCP服務器獲取IP
涉及技術:VLAN間通信/DHCP/DHCP中繼/RIP
拓撲圖:
技術分享圖片
VLAN劃分:
VLAN10:PC6/7/8 192.168.10.0/24
VLAN20:PC0/1 192.168.20.0/24
VLAN30:PC4/5 192.168.30.0/24
VLAN40:PC2/3 192.168.40.0/24
VLAN50:PC9/10/11 192.168.50.0/24

DHCP設備劃分:
VLAN10:三層交換機DHCPvlan10
VLAN20/30/40:三層交換機DHCPvlan20-40

VLAN50:三層交換機DHCPvlan50

實驗思路:
一:先確保各自VLAN主機到對應網關的路由器接口處暢通(尚無配置DHCP,臨時用靜態IP地址進行測試)
二:分段配置完成後,配置中間路由器部分。使其各部分進行“連接”
三:配置各自VLAN對應的DHCP設備
三:將終端PC的靜態IP地址改為動態獲取,成功獲取後進行全網互通測試。

配置思路:
一:二層交換機配置
#VLAN創建和劃分
#access/trunk鏈路的配置
二:三層交換機配置(VLAN劃分,access/trunk鏈路配置,DHCP對應各自)
#VLAN創建和劃分
#access/trunk鏈路的配置
#DHCP對應各自VLAN地址池的建立,DHCP自身IP的規劃

#開啟路由轉發功能
三:路由器配置
#接口IP的配置
#RIP的配置工作

實驗步驟:

VLAN10區域

二層交換機:
Switch#
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
備註:如果只創建本區域VLAN的話,其他VLAN廣播域內的主機將無法訪問
Switch(config-vlan)#int range f0/1-f0/3
Switch(config-if-range)#sw mo ac

Switch(config-if-range)#sw ac vlan 10
Switch(config-if-range)#int f0/4
Switch(config-if)#
Switch(config-if)#sw mo tr
Switch(config-if)#end
Switch#wr
Switch#write
Building configuration...
[OK]

三層交換機:

DHCPvlan10>
DHCPvlan10>en
DHCPvlan10#conf
DHCPvlan10(config)#vlan 10
DHCPvlan10(config-vlan)#vlan 20
DHCPvlan10(config-vlan)#vlan 30
DHCPvlan10(config-vlan)#vlan 40
DHCPvlan10(config-vlan)#vlan 50
DHCPvlan10(config-vlan)#int f0/4
DHCPvlan10(config-if)#sw tr e d
DHCPvlan10(config-if)#sw mo tr
DHCPvlan10(config-if)#int f0/1
DHCPvlan10(config-if)#sw mo ac
DHCPvlan10(config-if)#sw ac vlan 10
DHCPvlan10(config-if)#int vlan 10
DHCPvlan10(config-if)#ip add 192.168.10.253 255.255.255.0
DHCPvlan10(config-if)#no shu
DHCPvlan10(config-if)#exit
DHCPvlan10(config)#ip dhcp pool vlan10
DHCPvlan10(dhcp-config)#network 192.168.10.0 255.255.255.0
DHCPvlan10(dhcp-config)#default-router 192.168.10.254
DHCPvlan10(dhcp-config)#dns-server 8.8.8.8
DHCPvlan10(dhcp-config)#exit
DHCPvlan10(config)#service dhcp
DHCPvlan10(config)#ip routing
DHCPvlan10(config)#end
DHCPvlan10#
DHCPvlan10#write
Building configuration...
[OK]

路由器:
GWvlan10>en
GWvlan10#conf
GWvlan10(config)#int g0/1
GWvlan10(config-if)#no shu
GWvlan10(config-if)#ip add 192.168.10.254 255.255.255.0
GWvlan10(config-if)#int g0/0
GWvlan10(config-if)#ip add 192.168.90.1 255.255.255.0
GWvlan10(config-if)#no shu
GWvlan10(config-if)#exit
GWvlan10(config)#rou rip
GWvlan10(config-router)#v 2
GWvlan10(config-router)#no aut
GWvlan10(config-router)#net 192.168.10.0
GWvlan10(config-router)#net 192.168.90.0
GWvlan10(config-router)#end
GWvlan10#
GWvlan10#write
Building configuration...
[OK]

至此,VLAN10區域的主機已經可以實現DHCP自動獲取功能。如下圖所示:
技術分享圖片

VLAN50區域:

二層交換機:
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/3
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 50
Switch(config-if-range)#int f0/4
Switch(config-if)#sw mo tr
Switch(config-if)#end
Switch#
Switch#write
Building configuration...
[OK]

三層交換機:
DHCPvlan50>en
DHCPvlan50#conf
DHCPvlan50(config)#vlan 10
DHCPvlan50(config-vlan)#vlan 20
DHCPvlan50(config-vlan)#vlan 30
DHCPvlan50(config-vlan)#vlan 40
DHCPvlan50(config-vlan)#vlan 50
DHCPvlan50(config-vlan)#int f0/4
DHCPvlan50(config-if)#sw tr e d
DHCPvlan50(config-if)#sw mo tr
DHCPvlan50(config-if)#int f0/1
DHCPvlan50(config-if)#sw mo ac
DHCPvlan50(config-if)#sw ac vlan 50
DHCPvlan50(config-if)#exit
DHCPvlan50(config)#ip dhcp pool vlan50
DHCPvlan50(dhcp-config)#network 192.168.50.0 255.255.255.0
DHCPvlan50(dhcp-config)#default-router 192.168.50.254
DHCPvlan50(dhcp-config)#dns-server 8.8.8.8
DHCPvlan50(dhcp-config)#int vlan 50
DHCPvlan50(config-if)#ip add 192.168.50.253 255.255.255.0
DHCPvlan50(config-if)#no shu
DHCPvlan50(config-if)#exit
DHCPvlan50(config)#ip routing
DHCPvlan50(config)#service dhcp
DHCPvlan50(config)#end
DHCPvlan50#write
Building configuration...
[OK]

路由器:
GWvlan50>en
GWvlan50#conf
GWvlan50(config)#int g0/1
GWvlan50(config-if)#ip add 192.168.50.254 255.255.255.0
GWvlan50(config-if)#no shu
GWvlan50(config-if)#int g0/0
GWvlan50(config-if)#ip add 192.168.100.1 255.255.255.0
GWvlan50(config-if)#no shu
GWvlan50(config-if)#exit
GWvlan50(config)#rou rip
GWvlan50(config-router)#v 2
GWvlan50(config-router)#no aut
GWvlan50(config-router)#net 192.168.100.0
GWvlan50(config-router)#net 192.168.50.0
GWvlan50(config-router)#end
GWvlan50#
GWvlan50#write
Building configuration...
[OK]

至此,VLAN50區域的主機已經可以實現DHCP自動獲取功能。如下圖所示:
技術分享圖片

VLAN20-40區域:

交換機

VLAN20
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/2
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 20
Switch(config-if-range)#int range f0/3,f0/6
Switch(config-if-range)#sw mo tr
Switch(config-if-range)#end
Switch#wr
Switch#write
Building configuration...
[OK]

VLAN30
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/2
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 30
Switch(config-if-range)#int range f0/6,f0/4,f0/7
Switch(config-if-range)#sw mo tr
Switch(config-if-range)#end
Switch#
Switch#write
Building configuration...
[OK]

VLAN40
Switch>en
Switch#conf
Switch(config)#vlan 10
Switch(config-vlan)#vlan 20
Switch(config-vlan)#vlan 30
Switch(config-vlan)#vlan 40
Switch(config-vlan)#vlan 50
Switch(config-vlan)#int range f0/1-f0/2
Switch(config-if-range)#sw mo ac
Switch(config-if-range)#sw ac vlan 30
Switch(config-if-range)#int range f0/5,f0/7
Switch(config-if-range)#sw mo tr
Switch(config-if-range)#end
Switch#
Switch#write
Building configuration...
[OK]

三層交換機(網關):
GWvlan20-40>en
GWvlan20-40#conf
GWvlan20-40(config)#vlan 10
GWvlan20-40(config-vlan)#vlan 20
GWvlan20-40(config-vlan)#vlan 30
GWvlan20-40(config-vlan)#vlan 40
GWvlan20-40(config-vlan)#vlan 50
GWvlan20-40(config-vlan)#int range f0/3-f0/5
GWvlan20-40(config-if-range)#sw tr e d
GWvlan20-40(config-if-range)#sw mo tr
GWvlan20-40(config-if)#int f0/1
GWvlan20-40(config-if)#no sw
GWvlan20-40(config-if)#ip add 192.168.60.1 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#int vlan 20
GWvlan20-40(config-if)#ip add 192.168.20.254 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#int vlan 30
GWvlan20-40(config-if)#ip add 192.168.30.254 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#int vlan 40
GWvlan20-40(config-if)#ip add 192.168.40.254 255.255.255.0
GWvlan20-40(config-if)#no shu
GWvlan20-40(config-if)#exit
GWvlan20-40(config)#router rip
GWvlan20-40(config-router)#v 2
GWvlan20-40(config-router)#no aut
GWvlan20-40(config-router)#net 192.168.20.0
GWvlan20-40(config-router)#net 192.168.30.0
GWvlan20-40(config-router)#net 192.168.40.0
GWvlan20-40(config-router)#net 192.168.60.0
GWvlan20-40(config-router)#exit
GWvlan20-40(config)#ip routing
GWvlan20-40(config)#exit
GWvlan20-40#
GWvlan20-40#write
Building configuration...
[OK]

三層交換機(DHCP):
DHCPvlan20-40>en
DHCPvlan20-40#conf
DHCPvlan20-40(config)#int f0/1
DHCPvlan20-40(config-if)#no sw
DHCPvlan20-40(config-if)#ip add 192.168.60.2 255.255.255.0
DHCPvlan20-40(config-if)#no shu
DHCPvlan20-40(config-if)#int f0/2
DHCPvlan20-40(config-if)#no sw
DHCPvlan20-40(config-if)#ip add 192.168.80.1 255.255.255.0
DHCPvlan20-40(config-if)#no shu
DHCPvlan20-40(config-if)#int f0/3
DHCPvlan20-40(config-if)#no shu
DHCPvlan20-40(config-if)#ip add 192.168.70.1 255.255.255.0
DHCPvlan20-40(config-if)#no sw
DHCPvlan20-40(config-if)#exit
DHCPvlan20-40(config)#ip dhcp pool vlan20
DHCPvlan20-40(dhcp-config)#network 192.168.20.0 255.255.255.0
DHCPvlan20-40(dhcp-config)#default-router 192.168.20.254
DHCPvlan20-40(dhcp-config)#dns-server 8.8.8.8
DHCPvlan20-40(dhcp-config)#exit
DHCPvlan20-40(config)#ip dhcp pool vlan30
DHCPvlan20-40(dhcp-config)#network 192.168.30.0 255.255.255.0
DHCPvlan20-40(dhcp-config)#default-router 192.168.30.254
DHCPvlan20-40(dhcp-config)#dns-server 8.8.8.8
DHCPvlan20-40(dhcp-config)#exit
DHCPvlan20-40(config)#ip dhcp pool vlan40
DHCPvlan20-40(dhcp-config)#network 192.168.40.0 255.255.255.0
DHCPvlan20-40(dhcp-config)#default-router 192.168.40.254
DHCPvlan20-40(dhcp-config)#dns-server 8.8.8.8
DHCPvlan20-40(dhcp-config)#exit
DHCPvlan20-40(config)#rou rip
DHCPvlan20-40(config-router)#v 2
DHCPvlan20-40(config-router)#no aut
DHCPvlan20-40(config-router)#net 192.168.80.0
DHCPvlan20-40(config-router)#net 192.168.70.0
DHCPvlan20-40(config-router)#net 192.168.60.0
DHCPvlan20-40(config-router)#exit
DHCPvlan20-40(dhcp-config)#ip routing
DHCPvlan20-40(dhcp-config)#service dhcp

至此,VLAN20/30/40區域的主機已經可以實現DHCP自動獲取功能。如下圖所示:
技術分享圖片
技術分享圖片
技術分享圖片

各區域之間路由器配置:

R0

Router>en
Router#conf
Router(config)#int g0/1
Router(config-if)#no shu
Router(config-if)#ip add 192.168.90.2 255.255.255.0
Router(config-if)#int g0/0
Router(config-if)#no shu
Router(config-if)#ip add 192.168.80.2 255.255.255.0
Router(config-if)#exit
Router(config)#rou rip
Router(config-router)#net 192.168.80.0
Router(config-router)#net 192.168.90.0
Router(config-router)#end
Router#
Router#write
Building configuration...
[OK]

R1
Router>en
Router#conf
Router(config)#int g0/0
Router(config-if)#no shu
Router(config-if)#ip add 192.168.70.2 255.255.255.0
Router(config-if)#int g0/1
Router(config-if)#no shu
Router(config-if)#ip add 192.168.100.2 255.255.255.0
Router(config-if)#exit
Router(config)#rou rip
Router(config-router)#v 2
Router(config-router)#no aut
Router(config-router)#net 192.168.70.0
Router(config-router)#net 192.168.100.0
Router(config-router)#end
Router#
Router#write
Building configuration...
[OK]

測試(其余測試圖重復性較多,便不再復述)
技術分享圖片
技術分享圖片

至此,實驗完畢

【實驗】綜合實驗-哢哢哢還是一頓整