400-035-6699
当前位置: 首页 » 技术支持 » 博文资讯 »

Cisco静态路由配置教程与最佳实践

在当今的网络世界中,配置路由器交换机是构建稳定网络环境关键步骤。以下是一个典型的网络配置案例,通过配置三个路由器(R1、R2、R3)和一个VPC(虚拟PC),我们将探讨如何搭建一个基本的网络拓扑结构,并测试其连通性。
首先,我们从R1的配置开始。R1连接了两个网络:192.168.1.0/24和192.168.12.0/24。在配置界面中,我们首先设置了R1的接口ip地址,确保每个接口都正确连接到对应的网络。通过查看接口IP,我们可以看到R1的各个接口状态IP地址分配情况。此外,我们还查看了R1的路由表,确认了各个网络的连接状态和路由信息。
接下来,我们转向R2。R2连接了192.168.12.0/24和192.168.23.0/24两个网络,它的配置与R1类似,同样是设置接口IP地址,并查看接口状态和路由表。在R2的路由表中,我们注意到它通过静态路由将192.168.1.0/24和192.168.3.0/24网络路由到R1。
然后是R3,它连接了192.168.23.0/24和192.168.3.0/24两个网络。与R1和R2一样,我们设置了R3的接口IP地址,并查看了接口状态和路由表。R3的路由表显示,它通过静态路由将192.168.1.0/24和192.168.12.0/24网络路由到R2。
为了测试网络的连通性,我们还配置了两个VPC:vpc4和vpc5。vpc4被配置为192.168.1.2/24网络,网关为192.168.1.254;vpc5被配置为192.168.3.2/24网络,网关为192.168.3.254。这两个VPC分别代表两个独立的网络终端
最后,我们在vpc4上执行ping操作,测试到vpc5的连通性。结果显示,vpc4与vpc5之间能够成功通信,这意味着我们的网络配置是正确的,数据包能够在这两个网络之间自由传输。
在这个过程中,我们不仅配置了路由器和VPC的IP地址,还设置了静态路由来确保不同网络之间的通信。查看每个设备的接口状态和路由表是验证配置正确性的关键步骤。通过这种方法,我们能够确保网络中的每个设备都能够正确地路由数据包,从而实现整个网络环境的稳定运行
在网络配置中,细节至关重要。每一步的准确性和精确性都会影响到整个网络的性能和稳定性。通过这个案例,我们可以看到,从配置路由器到测试网络连通性,每一步都需要仔细的操作和验证。只有这样,我们才能构建出一个高效、稳定的网络环境。

实验拓扑

Cisco静态路由配置教程与最佳实践

a2dc4bc2-90f6-11ee-939d-92fbcf53809c.jpg

配置R1

 
Router(config)




R1(config)
R1(config-if)
R1(config-if)




R1(config-if)
R1(config-if)
R1(config-if)




R1(config)
R1(config)
 

查看接口ip

 
R1
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.12.1    YES manual up                    up      
Ethernet0/1                192.168.1.254   YES manual up                    up      
Ethernet0/2                unassigned      YES unset  administratively down down    
Ethernet0/3                unassigned      YES unset  administratively down down    
Serial1/0                  unassigned      YES unset  administratively down down    
Serial1/1                  unassigned      YES unset  administratively down down    
Serial1/2                  unassigned      YES unset  administratively down down    
Serial1/3                  unassigned      YES unset  administratively down down 
 

查看R1路由表

 
R1
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR


Gateway of last resort is not set


      192.168.1.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.1.0/24 is directly connected, Ethernet0/1
L        192.168.1.254/32 is directly connected, Ethernet0/1
S     192.168.3.0/24 [1/0] via 192.168.12.2
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/0
L        192.168.12.1/32 is directly connected, Ethernet0/0
S     192.168.23.0/24 [1/0] via 192.168.12.2
 

配置R2

 
Router>enable
router
Router(config)




R2(config)
R2(config-if)
R2(config-if)




R2(config-if)
R2(config-if)
R2(config-if)




R2(config)
R2(config)
 

查看接口ip

 
R2
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.12.2    YES manual up                    up      
Ethernet0/1                192.168.23.2    YES manual up                    up      
Ethernet0/2                unassigned      YES unset  administratively down down    
Ethernet0/3                unassigned      YES unset  administratively down down    
Serial1/0                  unassigned      YES unset  administratively down down    
Serial1/1                  unassigned      YES unset  administratively down down    
Serial1/2                  unassigned      YES unset  administratively down down    
Serial1/3                  unassigned      YES unset  administratively down down
 

查看路由

 
R2
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR


Gateway of last resort is not set


S     192.168.1.0/24 [1/0] via 192.168.12.1
S     192.168.3.0/24 [1/0] via 192.168.23.3
      192.168.12.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.12.0/24 is directly connected, Ethernet0/0
L        192.168.12.2/32 is directly connected, Ethernet0/0
      192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.23.0/24 is directly connected, Ethernet0/1
L        192.168.23.2/32 is directly connected, Ethernet0/1
 

配置R3

 
Router>enable 
Router
Router(config)
R3(config)


R3(config)
R3(config-if)
R3(config-if)


R3(config-if)
R3(config-if)
R3(config-if)


R3(config)
R3(config)

查看接口ip

 
R3
Interface                  IP-Address      OK? Method Status                Protocol
Ethernet0/0                192.168.23.3    YES manual up                    up      
Ethernet0/1                192.168.3.254   YES manual up                    up      
Ethernet0/2                unassigned      YES unset  administratively down down    
Ethernet0/3                unassigned      YES unset  administratively down down    
Serial1/0                  unassigned      YES unset  administratively down down    
Serial1/1                  unassigned      YES unset  administratively down down    
Serial1/2                  unassigned      YES unset  administratively down down    
Serial1/3                  unassigned      YES unset  administratively down down   
 

查看路由

 
R3
Codes: L - local, C - connected, S - static, 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
       i - IS-IS, su - IS-IS summary, 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, H - NHRP, l - LISP
       a - application route
       + - replicated route, % - next hop override, p - overrides from PfR


Gateway of last resort is not set


S     192.168.1.0/24 [1/0] via 192.168.23.2
      192.168.3.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.3.0/24 is directly connected, Ethernet0/1
L        192.168.3.254/32 is directly connected, Ethernet0/1
S     192.168.12.0/24 [1/0] via 192.168.23.2
      192.168.23.0/24 is variably subnetted, 2 subnets, 2 masks
C        192.168.23.0/24 is directly connected, Ethernet0/0
L        192.168.23.3/32 is directly connected, Ethernet0/0
 

配置vpc4

 
VPCS> ip 192.168.1.2/24 192.168.1.254
Checking for duplicate address...
VPCS : 192.168.1.2 255.255.255.0 gateway 192.168.1.254
 

配置vpc5

 
VPCS> ip 192.168.3.2/24 192.168.3.254
Checking for duplicate address...
VPCS : 192.168.3.2 255.255.255.0 gateway 192.168.3.254
 

在vpc4上ping vpc5测试连通性

 
VPCS> ping 192.168.3.2


84 Bytes from 192.168.3.2 icmp_seq=1 ttl=61 time=0.958 ms
84 bytes from 192.168.3.2 icmp_seq=2 ttl=61 time=0.785 ms
84 bytes from 192.168.3.2 icmp_seq=3 ttl=61 time=1.050 ms
84 bytes from 192.168.3.2 icmp_seq=4 ttl=61 time=0.823 ms
84 bytes from 192.168.3.2 icmp_seq=5 ttl=61 time=0.827 ms
 

审核编辑:汤梓红

【限时免费】一键获取网络规划系统模板+传输架构设计+连通性评估方案

相关文章

服务电话:
400-035-6699
企服商城