这篇文章总字数为:4265 字,有 0 张图存于本站服务器
实验设备:
- windows系统
- CiscoPacketTracer工具软件
要求组网拓扑:
我的拓扑图:
拓扑连好后,配置路由器和计算机。
进入路由配置
你也可以通过物理方式打开端口,设置端口ip地址设置rip,小白请勿尝试!记不住容易弄乱,还是乖乖按下面的命令配置rip和ospf吧,不过,开启端口可以在这里开,和命令输入的no shutdown效果是一样的。
路由器几种常见状态:
- 路由初级状态:Router>
- 特权模式状态:Router#
- 全局模式状态:Router(config)#
路由配置关键命令:
进入路由特权模式:Router>en
进入路由全局模式:Router#conf
配置路由器名字:Router(config)#hostname 名字
进入端口F端口:Router(config)#int f0/0
进入端口G端口:Router(config)#int g0/0
进入端口S端口:Router(config)#int s0/0
创建loop口:Router(config)#int loop0
配置端口ip地址:Router(config-if)#ip add 192.168.1.1 255.255.255.0
打开F、G、S端口:先进入端口Router(config)#int g0/0,再Router(config-if)#no shutdown,也可以通过物理方法打开端口,端口一定要开,不开不通,全红。
返回上一级:exit
查看路由表:Router#sh ip ro
查看路由器配置信息:Router#sh run
保存路由器配置信息:Router#write
本次作业重分发rip配置:
Router(config)#router rip
Router(config-if)#redistribute ospf 1
Router(config-if)#net 192.168.1.0
Router(config-if)#net 192.168.11.0
Router(config-if)#no auto-summary
本次作业重分发ospf配置:
Router(config)#router ospf 1
Router(config-if)#log-adjacency-changes
Router(config-if)#redistribute rip metric 10 metric-type 1 subnets
Router(config-if)#network 192.168.2.0 0.0.0.255 area 0
本次作业普通ospf配置:
Router(config)#router ospf 1
Router(config-if)#log-adjacency-changes
Router(config-if)#network 192.168.2.0 0.0.0.255 area 0
Router(config-if)#network 192.168.3.0 0.0.0.255 area 2
普通ospf协议:
Router(config)#router ospf 1
Router(config-if)#log-adjacency-changes
Router(config-if)#net 192.168.3.0 0.0.0.255 area 2
Router(config-if)#net 10.4.1.0 0.0.0.255 area 2
普通rip协议:
Router(config)#Router rip
Router(config-if)#net 192.168.1.0
具体每台路由器配置详见下面路由器配置信息!!!
配置路由器
下面配置信息中红色加粗的是真正要敲的命令!!!
R1配置:
R1#sh run
Building configuration...
Current configuration : 779 bytes
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
hostname R1
ip cef
no ipv6 cef
license udi pid CISCO1941/K9 sn FTX1524T465
spanning-tree mode pvst
interface Loopback0
ip address 1.1.1.1 255.255.255.255
interface GigabitEthernet0/0
ip address 192.168.11.1 255.255.255.0
duplex auto
speed auto
interface GigabitEthernet0/1
ip address 192.168.1.1 255.255.255.0
duplex auto
speed auto
interface Vlan1
no ip address
shutdown
router rip
redistribute ospf 1
network 192.168.1.0
network 192.168.11.0
no auto-summary
ip classless
ip flow-export version 9
line con 0
line aux 0
line vty 0 4
login
end
R2配置:
R2#sh run
Building configuration...
Current configuration : 893 bytes
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
hostname R2
ip cef
no ipv6 cef
license udi pid CISCO1941/K9 sn FTX1524K906
spanning-tree mode pvst
interface Loopback0
ip address 2.2.2.2 255.255.255.255
interface GigabitEthernet0/0
ip address 192.168.2.1 255.255.255.0
duplex auto
speed auto
interface GigabitEthernet0/1
ip address 192.168.1.2 255.255.255.0
duplex auto
speed auto
interface Vlan1
no ip address
shutdown
router ospf 1
log-adjacency-changes
redistribute rip metric 10 metric-type 1 subnets
network 192.168.2.0 0.0.0.255 area 0
router rip
redistribute ospf 1 metric 3
network 192.168.1.0
no auto-summary
ip classless
line con 0
line aux 0
line vty 0 4
login
end
R3配置:
R3#sh run
Building configuration...
Current configuration : 798 bytes
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
hostname R3
ip cef
no ipv6 cef
license udi pid CISCO1941/K9 sn FTX1524BS04
spanning-tree mode pvst
interface Loopback0
ip address 3.3.3.3 255.255.255.255
interface GigabitEthernet0/0
ip address 192.168.2.2 255.255.255.0
duplex auto
speed auto
interface GigabitEthernet0/1
ip address 192.168.3.1 255.255.255.0
duplex auto
speed auto
interface Vlan1
no ip address
shutdown
router ospf 1
log-adjacency-changes
network 192.168.2.0 0.0.0.255 area 0
network 192.168.3.0 0.0.0.255 area 2
ip classless
ip flow-export version 9
line con 0
line aux 0
line vty 0 4
login
end
R4配置:
R4#sh run
Building configuration...
Current configuration : 792 bytes
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
hostname R4
ip cef
no ipv6 cef
license udi pid CISCO1941/K9 sn FTX1524SMPA
spanning-tree mode pvst
interface Loopback0
ip address 4.4.4.4 255.255.255.255
interface GigabitEthernet0/0
ip address 10.4.1.1 255.255.255.0
duplex auto
speed auto
interface GigabitEthernet0/1
ip address 192.168.3.2 255.255.255.0
duplex auto
speed auto
interface Vlan1
no ip address
shutdown
router ospf 1
log-adjacency-changes
network 192.168.3.0 0.0.0.255 area 2
network 10.4.1.0 0.0.0.255 area 2
ip classless
ip flow-export version 9
line con 0
line aux 0
line vty 0 4
login
end
配置计算机
P0配置:
P1配置:
路由表信息
这里仅展示R2和R4路由表,自己动手丰衣足食,另外两个自行查询,命令是Router#sh ip ro
R2路由表信息
R4路由表信息
连通性测试
PC0 ping R4和PC1
PC1 ping R1和PC0
评论