動態路由實驗

 

 

 

本實驗爲交換與路由的綜合實驗,完成本實驗,目的是爲了掌握子網的劃分、配置VLAN,以及在路由器上配置單臂路由來實現VLAN之間的路由;並且掌握在有子網的情況下使用靜態路由協議實現子網的互通。

clip_image002

所需實驗設備

1)3臺路由器 2)2臺交換機 3)2根交叉線 4)2根直連線

實驗描述

1、劃分子網 在192.168.1.0/25網段上包含3個VLAN,其中,VLAN 2中包含50臺主機,VLAN 3和4中各包含25臺主機;請寫出子網劃分的方案; 2、配置VLAN與單臂路由 1)在交換機上配置靜態路由) 在路由器上配置單臂路由,實現交換機上各VLAN的互通; 3、配置RIP路由協議 在3臺路由器上配置RIP路由協議,實現兩臺交換機上連接的各網段的互通。 4.交換機的轉發原理 如果同在一個VLAN中的兩臺主機互相ping通後,是否還能不同vlan間ping通?爲什麼?

提交作業

1) 路由器與交換機的配置文件 2) 實驗報告

子網劃分:

因爲2的2次方是4,所以192.168.1.0/25再借一位就可以了。子網掩碼爲255.255.255.192

Vlan2網絡地址:192.168.1.0 可用IP:192.168.1.1—192.168.1.62 廣播地址:192.168.1.63

Vlan3、vlan4網絡地址:192.168.1.64 可用IP:192.168.1.65—192.168.1.126 廣播地址:192.168.1.127

Vlan2網絡地址:192.168.1.128 可用IP:192.168.1.129—192.168.1.190 廣播地址:192.168.1.191

Vlan3、vlan4網絡地址:192.168.1.192 可用IP:192.168.1.193—192.168.1.254 廣播地址:192.168.1.255

clip_image004

靜態試驗一:

基本思路:

(一)對於路由器:

1:命名

2:設置端口IP和激活相應端口

3:配置單臂路由(對於R1和R3)

4:配置靜態路由

(二)對於交換機:

1:命名

2:添加vlan

3:將指定端口添加到指定vlan

4:將相應端口設置成trunk模式

(三)對於PC(這裏把router當做PC):

1:命名

2:設置IP

(四)查看命名:

查看基本配置:

show running-config

查看vlan信息:

show vlan-switchport

查看端口信息:

show interface 端口號

查看路由信息:

show ip route

--------------------------------------------------

配置文檔:

R1:

enable

config terminal

no ip domain-lookup //禁止DNS服務

hostname R1

interface f0/0

no shutdown

interface f1/0

ip address 10.10.1.1 255.255.255.0 //設置IP

no shutdown

interface f0/0.2 //設置子端口信息

encapsulation dot1q 2

ip address 192.168.1.1 255.255.255.192

exit

interface f0/0.3 //設置子端口信息

encapsulation dot1q 3

ip address 192.168.1.65 255.255.255.192

no shutdown

exit

ip route 10.20.1.0 255.255.255.0 10.10.1.2 //設置靜態路由

ip route 192.168.1.128 255.255.255.128 10.10.1.2 //設置靜態路由

end

write

------------------------------------------------------

R2:

enable

config terminal

no ip domain-lookup //禁止DNS服務

hostname R2

interface f0/0

ip address 10.10.1.2 255.255.255.0 //設置IP

no shutdown

interface f1/0

ip address 10.20.1.1 255.255.255.0 //設置IP

no shutdown

ip route 192.168.1.0 255.255.255.128 10.10.1.1 //設置靜態路由

ip route 192.168.1.128 255.255.255.128 10.20.1.2 //設置靜態路由

end

write

-----------------------------------------------------------

R3:

enable

config terminal

no ip domain-lookup //禁止DNS服務

hostname R3

interface f1/0

no shutdown

interface f0/0

ip address 10.20.1.2 255.255.255.0 //設置IP

no shutdown

interface f1/0.2 //設置子端口信息

encapsulation dot1q 2

ip address 192.168.1.129 255.255.255.192

exit

interface f1/0.3 //設置子端口信息

encapsulation dot1q 3

ip address 192.168.1.193 255.255.255.192

exit

ip route 10.10.1.0 255.255.255.0 10.20.1.1 //設置靜態路由

ip route 192.168.1.0 255.255.255.128 10.20.1.1 //設置靜態路由

end

write

-------------------------------------------------------

sw1:

enable

config terminal

hostname sw1

exit

vlan database //添加vlan

vlan 2

vlan 3

exit

config terminal

interface f0/0

switchport mode trunk //將指定端口設置成trunk

interface f0/2

switchport access vlan 2 //將指定端口添加到指定vlan

interface f0/3

switchport access vlan 3 //將指定端口添加到指定vlan

end

write

---------------------------------------------------------------

sw2:

enable

config terminal

hostname sw2

exit

vlan database //添加vlan

vlan 2

vlan 3

exit

config terminal

interface f0/0

switchport mode trunk //將指定端口設置成trunk

interface f0/2

switchport access vlan 2 //將指定端口添加到指定vlan

interface f0/3

switchport access vlan 3 //將指定端口添加到指定vlan

end

write

------------------------------------------------------------

pc1:

enable

config terminal

no ip routing

hostname pc1

interface f0/0

ip address 192.168.1.20 255.255.255.192 //設置IP

no shutdown

end

write

------------------------------------------------------------

pc2:

enable

config terminal

no ip routing

hostname pc2

interface f0/0

ip address 192.168.1.68 255.255.255.192 //設置IP

no shutdown

end

write

------------------------------------------------------------

pc3:

enable

config terminal

no ip routing

hostname pc3

interface f0/0

ip address 192.168.1.168 255.255.255.192 //設置IP

no shutdown

end

write

------------------------------------------------------------

pc4:

enable

config terminal

no ip routing

hostname pc4

interface f0/0

ip address 192.168.1.200 255.255.255.192 //設置IP

no shutdown

end

write

調試圖片:

clip_image006clip_image008clip_image010clip_image012clip_image014

clip_image016

靜態路由實驗2:

基本思路:

(一)對於路由器:

1:命名

2:設置端口IP和激活相應端口

3:配置單臂路由(對於R1和R3)

4:配置靜態路由

(二)對於交換機:

1:命名

2:添加vlan

3:將指定端口添加到指定vlan

4:將相應端口設置成trunk模式

(三)對於PC(這裏把router當做PC):

1:命名

2:設置IP

(四)查看命名:

查看基本配置:

show running-config

查看vlan信息:

show vlan-switchport

查看端口信息:

show interface 端口號

查看路由信息:

show ip route

--------------------------------------------------

配置文檔:

R1:

enable

config terminal

no ip domain-lookup

hostname R1

interface f0/0

no shutdown

interface f1/0

ip address 10.10.1.1 255.255.255.0

no shutdown

interface f0/0.2

encapsulation dot1q 2

ip address 192.168.1.1 255.255.255.192

exit

interface f0/0.3

encapsulation dot1q 3

ip address 192.168.1.65 255.255.255.192

no shutdown

exit

ip route 10.20.1.0 255.255.255.0 10.10.1.2

ip route 192.168.1.128 255.255.255.192 10.10.1.2

ip route 192.168.1.192 255.255.255.192 10.10.1.2

end

write

------------------------------------------------------

R2:

enable

config terminal

no ip domain-lookup

hostname R2

interface f0/0

ip address 10.10.1.2 255.255.255.0

no shutdown

interface f1/0

ip address 10.20.1.1 255.255.255.0

no shutdown

ip route 192.168.1.0 255.255.255.192 10.10.1.1

ip route 192.168.1.64 255.255.255.192 10.10.1.1

ip route 192.168.1.128 255.255.255.192 10.20.1.2

ip route 192.168.1.192 255.255.255.192 10.20.1.2

end

write

-----------------------------------------------------------

R3:

enable

config terminal

no ip domain-lookup

hostname R3

interface f1/0

no shutdown

interface f0/0

ip address 10.20.1.2 255.255.255.0

no shutdown

interface f1/0.2

encapsulation dot1q 2

ip address 192.168.1.129 255.255.255.192

exit

interface f1/0.3

encapsulation dot1q 3

ip address 192.168.1.193 255.255.255.192

exit

ip route 10.10.1.0 255.255.255.0 10.20.1.1

ip route 192.168.1.0 255.255.255.192 10.20.1.1

ip route 192.168.1.64 255.255.255.192 10.20.1.1

end

write

-------------------------------------------------------

sw1:

enable

config terminal

hostname sw1

exit

vlan database

vlan 2

vlan 3

exit

config terminal

interface f0/0

switchport mode trunk

interface f0/2

switchport access vlan 2

interface f0/3

switchport access vlan 3

end

write

---------------------------------------------------------------

sw2:

enable

config terminal

hostname sw2

exit

vlan database

vlan 2

vlan 3

exit

config terminal

interface f0/0

switchport mode trunk

interface f0/2

switchport access vlan 2

interface f0/3

switchport access vlan 3

end

write

------------------------------------------------------------

pc1:

enable

config terminal

no ip routing

hostname pc1

interface f0/0

ip address 192.168.1.20 255.255.255.192

no shutdown

end

write

------------------------------------------------------------

pc2:

enable

config terminal

no ip routing

hostname pc2

interface f0/0

ip address 192.168.1.68 255.255.255.192

no shutdown

end

write

------------------------------------------------------------

pc3:

enable

config terminal

no ip routing

hostname pc3

interface f0/0

ip address 192.168.1.168 255.255.255.192

no shutdown

end

write

------------------------------------------------------------

pc4:

enable

config terminal

no ip routing

hostname pc4

interface f0/0

ip address 192.168.1.200 255.255.255.192

no shutdown

end

write

調試圖片:

clip_image016[1]

備註:對於上面兩種方式設置靜態路由,雖然都能夠P通,但是發現一個問題就是第二種方法設置靜態路由時候比較麻煩點,而且考慮到vlan的問題…相對來說,第一種方式更加簡便,而且容易實現…..

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章