路由器综合实验

路由综合实验
技术原理
为了支持本设备能够运行多个路由协议进程,系统软件提供了路由信息从一个路由进程重分布到另一个路由器进程的功能。
实验步骤:
1.pc与交换机间用直线连接;pc与路由、路由与路由之间用交叉线连接。
2.再三层交换机划分2个vlan,运行ripv2协议;R2运行ospf协议
3.在路由器R1上左侧配置RIPV2路由协议;右侧配置ospf协议
4.在R1路由器进程中引入外部路由,进行路由分布
5.将pc1、pc2主机默认网关分别设置为与直接网络设备接口ip地址
6.验证pc1、pc2主机之间可以互相通信
SW0交换机配置:

Switch>en
Switch#config t
Enter configuration commands, one perline.End with CNTL/Z.
Switch(config)#host SW0
SW0(config)#vlan 2
SW0(config-vlan)#name v2
SW0(config-vlan)#exit
SW0(config)#int fa0/10
SW0(config-if)#switchport access vlan 2
SW0(config-if)#exit
SW0(config)#int vlan 1
SW0(config-if)#ip address 192.168.1.1255.255.255.0
SW0(config-if)#no shut


%LINK-5-CHANGED: Interface Vlan1, changedstate to up


%LINEPROTO-5-UPDOWN: Line protocol on InterfaceVlan1, changed state to up


SW0(config-if)#exit
SW0(config)#int vlan 2
SW0(config-if)#
%LINK-5-CHANGED: Interface Vlan2, changedstate to up


SW0(config-if)#ip address 192.168.2.1255.255.255.0
SW0(config-if)#no shut
SW0(config-if)#exit
SW0(config)#router rip
SW0(config-router)#network 192.168.1.0
SW0(config-router)#network 192.168.2.0
SW0(config-router)#version 2
SW0(config-router)#exit
SW0(config)#ip routing


R0配置
Router>en
Router#config t
Enter configuration commands, one perline.End with CNTL/Z.
Router(config)#host R0
R0(config)#int fa0/0
R0(config-if)#ip address 192.168.2.2255.255.255.0
R0(config-if)#no shut


%LINK-5-CHANGED: Interface FastEthernet0/0,changed state to up


%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up


R0(config-if)#exit
R0(config)#int fa0/1
R0(config-if)#ip address 192.168.3.1255.255.255.0
R0(config-if)#no shut


R0(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1,changed state to up
exit
R0(config)#exit
R0#
%SYS-5-CONFIG_I: Configured from console byconsole


R0#config t
Enter configuration commands, one perline.End with CNTL/Z.
R0(config)#router rip
R0(config-router)#network 192.168.2.0
R0(config-router)#version 2
R0(config-router)#exit
R0(config)#router ospf 1
R0(config-router)#network 192.168.3.00.0.0.255 area 0
R0(config-router)#exit


R1配置:
Router>en
Router#config t
Enter configuration commands, one perline.End with CNTL/Z.
Router(config)#host R1
R1(config)#int fa0/1
R1(config-if)#ip address 192.168.3.2255.255.255.0
R1(config-if)#no shut


%LINK-5-CHANGED: Interface FastEthernet0/1,changed state to up


%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/1, changed state to up


R1(config-if)#exit
R1(config)#int fa0/0
R1(config-if)#ip address 192.168.4.1 255.255.255.0
R1(config-if)#no shut


%LINK-5-CHANGED: Interface FastEthernet0/0,changed state to up


%LINEPROTO-5-UPDOWN: Line protocol onInterface FastEthernet0/0, changed state to up


R1(config-if)#exit
R1(config)#router ospf 1
R1(config-router)#network 192.168.3.00.0.0.255 area 0
R1(config-router)#network 192.168.4.00.0.0.255
00:26:58: %OSPF-5-ADJCHG: Process 1, Nbr192.168.3.1 on FastEthernet0/1 from LOADING to FULL, Loading Done
area 0
R1(config-router)#network 192.168.4.00.0.0.255 area 0
R1(config-router)#exit
R1(config)#
测试:
ping 192.168.4.2 不通;
在交换机SW0上shiproute只能看见两条直连路由。
在R0上配置:
R0#config t
Enter configuration commands, one perline.End with CNTL/Z.
R0(config)#router rip
R0(config-router)#redistribute ospf 1
R0(config-router)#exit
R0(config)#router ospf 1
R0(config-router)#redistribute rip subnets
R0(config-router)#exit
R0(config)#
在SW0上添加静态路由:SW0(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
就一切ok了。
【路由器综合实验】转载于:https://blog.51cto.com/1054054/1252712

    推荐阅读