6.3

发布时间 2023-06-11 08:52:15作者: 意い十三章

接昨日总结代码:

2) 路由器基本配置

在路由器A上配置端口IP

Router>enable
Router#
Router#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 172.16.1.1 255.255.255.0
Router(config-if)#no shutdown
Router(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router(config-if)#interface serial 0/3/0
Router(config-if)#ip address 172.16.2.1 255.255.255.0
Router(config-if)#Clock rate 64000
Router(config-if)#no shutdown

 

在路由器B上配置端口IP

Router(config)#interface Serial0/3/0
Router(config-if)#ip address 172.16.2.2 255.255.255.0
Router(config-if)#
Router(config-if)#exit
Router(config)#interface FastEthernet0/0
Router(config-if)#ip address 172.16.3.1 255.255.255.0
Router(config-if)#ip address 172.16.3.1 255.255.255.0
Router(config-if)#
Router(config-if)#exit

验证测试:验证路由器接口的配置和状态
Router#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.16.2.1 YES manual up up
FastEthernet1/0 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial3/0 unassigned YES unset administratively down down
FastEthernet4/0 unassigned YES unset administratively down down
FastEthernet5/0 unassigned YES unset administratively down down


Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 172.16.3.1 YES manual administratively down down
FastEthernet1/0 unassigned YES unset administratively down down
Serial2/0 unassigned YES unset administratively down down
Serial3/0 unassigned YES unset administratively down down
FastEthernet4/0 unassigned YES unset administratively down down
FastEthernet5/0 unassigned YES unset administratively down down

2、配置RIPv2路由协议

1)三层交换机配置RIP协议

Switch>enable
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#router rip
IP routing not enabled
Switch(config)#ip routing
Switch(config)#router rip
Switch(config-router)#network 172.16.1.0
Switch(config-router)#network 172.16.5.0
Switch(config-router)#version 2
Switch(config-router)#

2)RA配置RIP v2协议

Router(config)#router rip
Router(config-router)#network 172.16.1.0
Router(config-router)#network 172.16.2.0
Router(config-router)#version 2
Router(config-router)#no auto-summary
Router(config-router)#

3)RB配置RIP v2协议

Router(config)#router rip
Router(config-router)#network 172.16.2.0
Router(config-router)#network 172.16.3.0
Router(config-router)#version 2
Router(config-router)#no auto-summary

3、验证三台路由设备的路由表,查看是否自动学习了其他网段的路由信息。

Switch#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 2 subnets
C 172.16.1.0 is directly connected, Vlan10
C 172.16.5.0 is directly connected, Vlan50

 

Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

172.16.0.0/24 is subnetted, 1 subnets
C 172.16.2.0 is directly connected, FastEthernet0/0

 

Router#show ip route
Codes: C - connected, S - static, I - IGRP, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2, E - EGP
i - IS-IS, L1 - IS-IS level-1, L2 - IS-IS level-2, ia - IS-IS inter area
* - candidate default, U - per-user static route, o - ODR
P - periodic downloaded static route

Gateway of last resort is not set

4、配置OSPF路由协议

三层交换机
Switch#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#router ospf 1
Switch(config-router)#network 172.16.5.0 0.0.0.255 area 0
Switch(config-router)#network 172.16.1.0 0.0.0.0 area 0

 

路由器RA
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 172.16.1.0 0.0.0.255 area 0
Router(config-router)#network 172.16.2.0 0.0.0.255 area 0
Router(config-router)#end

路由器RB

Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#router ospf 1
Router(config-router)#network 172.16.2.0 0.0.0.255 area 0
Router(config-router)#netwo
01:06:57: %OSPF-5-ADJCHG: Process 1, Nbr 172.16.2.1 on Serial0/3/0 from LOADING to FULL, Loading Done
% Incomplete command.
Router(config-router)#network 172.16.3.0 0.0.0.255 area 0
Router(config-router)#end

5、测试网络的连通性
从PCA ping PCB
网络跟踪命令:
tracert ip
结果:显示到达目的主机经过的每一跳路由的接口地址