两台路由器之间静态路由配置
实验环境为:Cisco Packet Tracer7.0
两台路由器之间静态路由配置
实验拓扑:
路由器0配置:
Press RETURN to get started!
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router0
Router0(config)#int f 0/1
Router0(config-if)#ip add 172.16.0.254 255.255.255.0
Router0(config-if)#no shut
Router0(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router0(config-if)#exit
Router0(config)#int f 0/0
Router0(config-if)#ip add 192.168.0.1 255.255.255.0 ##配置Fa0/0地址
#PC配置时记得配置该地址为PC网关地址
Router0(config-if)#no shut
Router0(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
Router0(config-if)#exit
Router0(config)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
Router0(config)#ip route 10.0.0.0 255.255.255.0 192.168.0.2
#目的网段 目的网段mask 下一跳地址
#配置指向10.0.0.0/24网段的静态路由
路由器1配置:
Press RETURN to get started!
Router>en
Router#config
Configuring from terminal, memory, or network [terminal]?
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname Router1
Router1(config)#int f 0/0
Router1(config-if)#ip add 192.168.0.2 255.255.255.0
Router1(config-if)#no shut
Router1(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
Router1(config-if)#int f 0/1
Router1(config-if)#ip add 10.0.0.254 255.255.255.0
Router1(config-if)#no shut
Router1(config-if)#
%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Router1(config-if)#exit
Router1(config)#ip route 172.16.0.0 255.255.255.0 192.168.0.1
#目的网段 目的网段mask 下一跳地址
#配置指向10.0.0.0/24网段的静态路由
PC0联通性测试
PC1连通性测
显示Router0接口信息:
Router0#show int f0/0
FastEthernet0/0 is up, line protocol is up (connected)
Hardware is Lance, address is 0002.17c2.7a01 (bia 0002.17c2.7a01)
Internet address is 192.168.0.1/24
MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
reliability 255/255, txload 1/255, rxload 1/255
Encapsulation ARPA, loopback not set #用以太网连接时,显示封装为Encapsulation ARPA
ARP type: ARPA, ARP Timeout 04:00:00,
Last input 00:00:08, output 00:00:05, output hang never
Last clearing of "show interface" counters never
Input queue: 0/75/0 (size/max/drops); Total output drops: 0
Queueing strategy: fifo
Output queue :0/40 (size/max)
5 minute input rate 0 bits/sec, 0 packets/sec
5 minute output rate 0 bits/sec, 0 packets/sec
0 packets input, 0 bytes, 0 no buffer
Received 0 broadcasts, 0 runts, 0 giants, 0 throttles
0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort
0 input packets with dribble condition detected
0 packets output, 0 bytes, 0 underruns
0 output errors, 0 collisions, 1 interface resets
0 babbles, 0 late collision, 0 deferred
0 lost carrier, 0 no carrier
0 output buffer failures, 0 output buffers swapped out
显示路由表信息:
Router0#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
10.0.0.0/24 is subnetted, 1 subnets
S 10.0.0.0 [1/0] via 192.168.0.2
172.16.0.0/24 is subnetted, 1 subnets
C 172.16.0.0 is directly connected, FastEthernet0/1
C 192.168.0.0/24 is directly connected, FastEthernet0/0