您的位置:首页 > 其它

简单的路由交换实验

2009-08-27 18:11 351 查看
实验名称:简单的路由交换实验
实验目的[/b][/b]熟练掌握Vlan的划分,中继链路的建立以及静态路由的配置
试验要求[/b][/b]1. pc1属于VLAN1;pc2属于VLAN2; pc3属于VLAN3;pc4属于VLAN4
2. pc1-pc5都能够联通
3. 子网划分192.168.1.0/24划分4子网,每个VLAN一个子网
网络拓朴图[/b][/b][align=left] [/align]
[align=left]请看附件![/align]
所需实验设备[/b][/b]1. 2台交换机
2. 3台路由器
3. 5台PC
4. 4个交叉线
5. 5个直连线
实验描述[/b][/b]1.交换机1的配置如下所示
******[/b]初始化交换机[/b]******[/b]
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host sw1
sw1(config)#lin con 0
sw1(config-line)#exec-timeout 0 0
sw1(config-line)#logging synchronous
sw1(config-line)#exit
sw1(config)#no ip domain lookup
sw1(config)#exit
[/b]******[/b]创建[/b]VLAN******[/b]
sw1#vlan database
sw1(vlan)#vlan 2 name v2
VLAN 2 added:
Name: v2
sw1(vlan)#vlan 3
VLAN 3 added:
Name: VLAN0003
sw1(vlan)#vlan 4
VLAN 4 added:
Name: VLAN0004
sw1(vlan)#exit
APPLY completed.
Exiting....
******[/b]将端口加入[/b]VLAN******[/b]
sw1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw1(config)#interface f0/4
sw1(config-if)#description vlan2
sw1(config-if)#switchport access vlan 2
sw1(config-if)#exit
*****[/b]设置端口为[/b]TRUNK[/b]并将[/b]vlan3 [/b]和[/b]vlan4[/b]加入中继[/b] *****[/b]
sw1(config)#interface f0/1
sw1(config-if)#switchport mode trunk
sw1(config-if)#switchport trunk allowed vlan add 3
sw1(config-if)#switchport trunk allowed vlan add 4
sw1(config-if)#exit

sw1(config)#interface f0/0
sw1(config-if)#switchport mode trunk
sw1(config-if)#switchport trunk allowed vlan add 3
sw1(config-if)#switchport trunk allowed vlan add 4
sw1(config-if)#end
sw1#write
2. 交换机2的配置如下所示
******[/b]初始化交换机[/b]******[/b]
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host sw2
sw2(config)#lin con 0
sw2(config-line)#exec-timeout 0 0
sw2(config-line)#logg sync
sw2(config-line)#exit
sw2(config)#no ip domain lookup
sw2(config)#exit
******[/b]创建[/b]VLAN******[/b]
sw2#vlan database
sw2(vlan)#vlan 2
VLAN 2 added:
Name: VLAN0002
sw2(vlan)#vlan 3 name v3
VLAN 3 added:
Name: v3
sw2(vlan)#vlan 4 name v4
VLAN 4 added:
Name: v4
sw2(vlan)#exit
APPLY completed.
Exiting....
******[/b]设置端口为中继模式并将[/b]vlan2[/b]加入中继[/b] ******[/b]
sw2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
sw2(config)#interface f0/2
sw2(config-if)#description vlan3
sw2(config-if)#switchport access vlan 3
sw2(config-if)#exit

sw2(config)#interface f0/4
sw2(config-if)#description vlan4
sw2(config-if)#switchport access vlan 4
sw2(config-if)#exit

sw2(config)#interface f0/1
sw2(config-if)#switchport mode trunk
sw2(config-if)#switchport trunk allowed vlan add 2
sw2(config-if)#end
sw2#write
3.路由器1的配置如下所示
[/b]****[/b]初使化路由器[/b] ****[/b]
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R1
R1(config)#lin con 0
R1(config-line)#exec-time 0 0
R1(config-line)#loggin syn
R1(config-line)#exit
R1(config)#no ip domain lookup
R1(config)#exit
**********[/b]为端口设置[/b]IP [/b]地址[/b]**********[/b]
R1#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#interface f0/0
R1(config-if)#ip add 10.0.0.2 255.0.0.0
R1(config-if)#no shut
R1(config-if)#exit

R1(config)#interface f1/0
R1(config-if)#ip add 20.0.0.1 255.0.0.0
R1(config-if)#no shut
R1(config-if)#exit
********[/b]设置静态路由[/b]********[/b]
R1(config)#ip route 30.0.0.0 255.0.0.0 20.0.0.2
R1(config)#ip route 40.0.0.0 255.0.0.0 20.0.0.2
R1(config)#ip route 192.168.1.0 255.255.255.192 20.0.0.2
R1(config)#ip route 192.168.1.64 255.255.255.192 20.0.0.2
R1(config)#ip route 192.168.1.128 255.255.255.192 20.0.0.2
R1(config)#ip route 192.168.1.192 255.255.255.192 20.0.0.2
R1(config)#exit
R1#write
4.路由器2的配置如下所示
****[/b]初使化路由器[/b] ****[/b]
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#host R2
R2(config)#lin con 0
R2(config-line)#exec-timeout 0 0
R2(config-line)#logg syn
R2(config-line)#exit
R2(config)#no ip domain lookup
R2(config)#exit
**********[/b]设置子接口[/b]**********[/b]
R2#conf t
Enter configuration commands, one per line. End with CNTL/Z.
R2(config)#interface f0/0
R2(config-if)#no shut
R2(config-if)#exit

R2(config)#interface f0/0.1
R2(config-subif)#encapsulation dot1q 1
R2(config-subif)#ip add 192.168.1.1 255.255.255.192
R2(config-subif)#exit

R2(config)#interface f0/0.2
R2(config-subif)#encapsulation dot1q 2
R2(config-subif)#ip add 192.168.1.65 255.255.255.192
R2(config-subif)#exit

R2(config)#interface f0/0.3
R2(config-subif)#encapsulation dot1q 3
R2(config-subif)#ip add 192.168.1.129 255.255.255.192
R2(config-subif)#exit

R2(config)#interface f0/0.4
R2(config-subif)#encapsulation dot1q 4
R2(config-subif)#ip add 192.168.1.193 255.255.255.192
R2(config-subif)#exit
[/b]********[/b]设置静态路由[/b]*********[/b]
R2(config)#ip route 40.0.0.0 255.0.0.0 30.0.0.2
R2(config)#ip route 10.0.0.0 255.0.0.0 20.0.0.1
R2(config)#exit
R2#write
5.路由器3的配置如下所示
[/b] ****[/b]初使化路由器[/b] ****[/b]
Router>
Router>en
Router#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#lin con 00
Router(config-line)#exec-t 0 0
Router(config-line)#logg syn
Router(config-line)#exit
Router(config)#no ip domain lookup
Router(config)#host r3
[/b] *********[/b]设置接口的[/b]IP[/b]地址[/b]**********[/b]
r3(config)#interfac e0/0
r3(config-if)#ip add 30.0.0.2 255.0.0.0
r3(config-if)#no shut
r3(config-if)#exit

r3(config)#interfac loopback 0
r3(config-if)#ip add 40.0.0.1 255.0.0.0
r3(config-if)#exit
********[/b]配置静态路由[/b]*********[/b]
r3(config)#ip route 10.0.0.0 255.0.0.0 30.0.0.1
r3(config)#ip route 20.0.0.0 255.0.0.0 30.0.0.1
r3(config)#ip route 192.168.1.0 255.255.255.192 30.0.0.1
r3(config)#ip route 192.168.1.64 255.255.255.192 30.0.0.1
r3(config)#ip route 192.168.1.128 255.255.255.192 30.0.0.1
r3(config)#ip route 192.168.1.192 255.255.255.192 30.0.0.1
r3(config)#exit
r3#write
实验结果[/b][/b]交换机[/b]sw1[/b]接口[/b]F0/0 [/b]的显示信息[/b][/b]
sw1#show interface f0/0 switchport
Name: Fa0/0
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1-4[/b]
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
交换机[/b]sw1[/b]接口[/b]F0/1[/b]的显示信息[/b][/b]
sw1#show interface f0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1-4
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
交换机[/b]sw2[/b]接口[/b]F0/1 [/b]的显示信息[/b][/b]
sw2#show interfac f0/1 switchport
Name: Fa0/1
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1-4[/b]
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
NAME IP/CIDR GATEWAY LPORT RPORT
PC1 192.168.1.8/26 192.168.1.1 10001 21002
PC2 192.168.1.68/26 192.168.1.65 10002 21004
PC3 192.168.1.138/26 192.168.1.129 10003 22002
PC4 192.168.1.198/26 192.168.1.193 10004 22004
本文出自 “展望未来” 博客,请务必保留此出处http://wjane.blog.51cto.com/916805/196323
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: