|
|
實驗目的網絡 |
本實驗爲交換與路由的綜合實驗,完成本實驗,目的是爲了掌握子網的劃分、配置VLAN,以及在路由器上配置單臂路由來實現VLAN之間的路由;而且掌握在有子網的狀況下使用動態路由協議實現子網的互通。dom |
所需實驗設備ide |
1)3臺路由器 2)2臺交換機 3)2根交叉線 4)2根直連線測試 |
實驗描述spa |
1、劃分子網 在192.168.1.0/25網段上包含3個VLAN,其中,VLAN 2中包含50臺主機,VLAN 3和4中各包含25臺主機;請寫出子網劃分的方案; 2、配置VLAN與單臂路由 1)在交換機上配置Vlan 2) 在路由器上配置單臂路由,實現交換機上各VLAN的互通; 3、配置RIP路由協議 在3臺路由器上配置RIP路由協議,實現兩臺交換機上鍊接的各網段的互通。 4.交換機的轉發原理 若是同在一個VLAN中的兩臺主機互相ping通後,其中一臺主機修改本地ARP表中另外一主機的MAC地址再ping,是否還內ping通?爲何?router |
提交做業blog |
1) 路由器與交換機的配置文件 2) 實驗報告接口 |
子網劃分:圖片
由於2的2次方是4,因此192.168.1.0/25再借一位就能夠了。子網掩碼爲255.255.255.192ip
Vlan2網絡地址:192.168.1.0 可用IP:192.168.1.1—192.168.1.62 廣播地址:192.168.1.63
Vlan三、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
Vlan三、vlan4網絡地址:192.168.1.192 可用IP:192.168.1.193—192.168.1.254 廣播地址:192.168.1.255
思路:
(一)對於路由器:
1:命名
2:配置接口iP
3:配置單臂路由(對於路由器1和3)
4:配置RIP
(二)對於交換機:
1:命名
2:添加vlan
3:將指定端口添加到指定vlan
4:設置指定端口爲trunk
(三)對於PC:
1:命名
2:禁用路由功能
3:設置IP
(四)查看命令:
查看基本配置:
show running-config
查看VLAN信息:
show vlan-switch
查看端口信息:
show interface 端口號
查看端口模式:
show interface 端口號 switchport
查看路由信息:
show ip route
查看路由協議:
show ip protocol
配置文檔:
R1:
enable
config terminal
no ip domain-lookup //禁用DNS服務
hostname R1
interface f0/0 //激活端口
no shutdown
interface f0/0.1 //設置子端口協議和IP
encapsulation dot1q 2
ip address 192.168.1.1 255.255.255.192
interface f0/0.2 //設置子端口協議和IP
encapsulation dot1q 3
ip address 192.168.1.65 255.255.255.192
exit
interface f1/0
ip address 192.168.10.1 255.255.255.0 //設置IP
no shutdown
exit
router rip //設置RIPv2版本
network 192.168.1.0
network 192.168.10.0
version 2
no auto-summary
end
write
R2:
enable
config terminal
no ip domain-lookup //禁用DNS服務
hostname R2
interface f0/0
ip address 192.168.10.2 255.255.255.0 設置IP
no shutdown
interface f1/0
ip address 192.168.20.1 255.255.255.0 設置IP
no shutdown
exit
router rip //設置RIPv2版本
network 192.168.10.0
network 192.168.20.0
version 2
no auto-summary
end
write
R3:
enable
config terminal
no ip domain-lookup //禁用DNS服務
hostname R3
interface f0/0
ip address 192.168.20.2 255.255.255.0 //設置IP
no shutdown
interface f1/0.3 //設置子端口協議和IP
encapsulation dot1q 2
ip address 192.168.1.129 255.255.255.192
interface f1/0.4 //設置子端口協議和IP
encapsulation dot1q 3
ip address 192.168.1.193 255.255.255.192
exit
interface f1/0 //激活端口
no shutdown
exit
router rip //設置RIPv2版本
network 192.168.1.128
network 192.168.20.0
version 2
no auto-summary
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.100 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
出現的錯誤:
因爲一開始沒有注意SW2 的接口是F1/0。因此在設置的時候把子端口設置錯誤了。。。應該是
F1/0.2的。。。
再一個這個子端口F1/0.2是個虛擬的端口。。。並且在這個圖中R1和R3鏈接SW的端口能夠不設置IP.!
測試圖片: