资源描述
静态路由配置
精品文档
实验十 静态路由配置
1实验目的
理解静态路由的工作原理,掌握如何配置静态的路由。
2实验要求
两台路由器通过串口以V.35 DCE/DTE电缆连接在一起,并在每个路由器上设置2个loopback端口模拟子网及静态路由,实现所有子网间的互通。
3实验拓扑
4实验配置
⑴RouterA的名称、接口IP地址和时钟的配置
R1762-3#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1762-3(config)#hostname routerA
routerA(config)#interface serial 1/2
routerA(config-if)#clock rate 512000
routerA(config-if)#ip address 192.168.1.1 255.255.255.0
routerA(config-if)#no shutdown
routerA(config-if)#exit
routerA(config)#
routerA(config)#interface loopback 0
routerA(config-if)#
%LINE PROTOCOL CHANGE: Interface Loopback 0, changed state to UP
routerA(config-if)#ip address 172.16.1.1 255.255.255.0
routerA(config-if)#exit
routerA(config)#interface loopback 1
routerA(config-if)#
%LINE PROTOCOL CHANGE: Interface Loopback 1, changed state to UP
routerA(config-if)#exit
routerA(config)#
routerA(config)#interface loopback 1
routerA(config-if)#ip address 172.16.2.1 255.255.255.0
routerA(config-if)#exit
routerA(config)#
routerA(config)#ip route 10.1.1.0 255.255.255.0 192.168.1.2
设置到子网10.1.1.0的静态路由,采用下一跳的方式
routerA(config)#ip route 10.2.2.0 255.255.255.0 s1/2
设置到子网10.2.2.0的静态路由,采用出站端口的方式
⑵RuterB的配置的名称、接口IP地址和时钟的配置
R1762-4#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
R1762-4(config)#hostname routerB
routerB(config)#interface serial 1/2
routerB(config-if)#ip address 192.168.1.2 255.255.255.0
routerB(config-if)#no shutdown
routerB(config-if)#exit
routerB(config)#
routerB(config)#interface loopback 0
routerB(config-if)#
%LINE PROTOCOL CHANGE: Interface Loopback 0, changed state to UP
routerB(config-if)#ip address 10.1.1.1 255.255.255.0
routerB(config-if)#exit
routerB(config)#
routerB(config)#interface loopback 1
routerB(config-if)#
%LINE PROTOCOL CHANGE: Interface Loopback 1, changed state to UP
routerB(config-if)#ip address 10.2.2.1 255.255.255.0
routerB(config-if)#exit
routerB(config)#ip route 172.16.1.0 255.255.255.0 192.168.1.1
设置到子网10.1.1.0的静态路由,采用下一跳的方式
routerB(config)#ip route 172.16.2.0 255.255.255.0 s1/2
设置到子网10.2.2.0的静态路由,采用出站端口的方式
5实验测试
⑴查看路由表和接口配置
routerA(config)#show ip route
Codes: C - connected, S - static, R - RIP
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
* - candidate default
Gateway of last resort is no set
S 10.1.1.0/24 [1/0] via 192.168.1.2
S 10.2.2.0/24 is directly connected, serial 1/2
C 172.16.1.0/24 is directly connected, Loopback 0
C 172.16.1.1/32 is local host.
C 172.16.2.0/24 is directly connected, Loopback 1
C 172.16.2.1/32 is local host.
C 192.168.1.0/24 is directly connected, serial 1/2
C 192.168.1.1/32 is local host.
routerA(config)#
routerA(config)#exit
routerA#show interface serial 1/2
serial 1/2 is UP , line protocol is UP
Hardware is PQ2 SCC HDLC CONTROLLER serial
Interface address is: 192.168.1.1/24
MTU 1500 bytes, BW 2000 Kbit
Encapsulation protocol is HDLC, loopback not set
Keepalive interval is 10 sec , set
Carrier delay is 2 sec
RXload is 1 ,Txload is 1
Queueing strategy: WFQ
5 minutes input rate 17 bits/sec, 0 packets/sec
5 minutes output rate 17 bits/sec, 0 packets/sec
761 packets input, 29578 bytes, 0 no buffer
Received 241 broadcasts, 0 runts, 0 giants
8 input errors, 0 CRC, 8 frame, 0 overrun, 0 abort
827 packets output, 32853 bytes, 0 underruns
0 output errors, 0 collisions, 6 interface resets
23 carrier transitions
V35 DCE cable
DCD=up DSR=up DTR=up RTS=up CTS=up
routerB(config)#show ip route
Codes: C - connected, S - static, R - RIP
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
* - candidate default
Gateway of last resort is no set
C 10.1.1.0/24 is directly connected, Loopback 0
C 10.1.1.1/32 is local host.
C 10.2.2.0/24 is directly connected, Loopback 1
C 10.2.2.1/32 is local host.
S 172.16.1.0/24 [1/0] via 192.168.1.1
S 172.16.2.0/24 is directly connected, serial 1/2
C 192.168.1.0/24 is directly connected, serial 1/2
C 192.168.1.2/32 is local host.
routerB(config)#
routerB(config)#exit
routerB#show interface serial 1/2
serial 1/2 is UP , line protocol is UP
Hardware is PQ2 SCC HDLC CONTROLLER serial
Interface address is: 192.168.1.2/24
MTU 1500 bytes, BW 2000 Kbit
Encapsulation protocol is HDLC, loopback not set
Keepalive interval is 10 sec , set
Carrier delay is 2 sec
RXload is 1 ,Txload is 1
Queueing strategy: WFQ
5 minutes input rate 17 bits/sec, 0 packets/sec
5 minutes output rate 17 bits/sec, 0 packets/sec
1031 packets input, 37341 bytes, 0 no buffer
Received 445 broadcasts, 0 runts, 0 giants
171 input errors, 3 CRC, 102 frame, 0 overrun, 66 abort
1186 packets output, 38928 bytes, 0 underruns
0 output errors, 0 collisions, 233 interface resets
309 carrier transitions
V35 DTE cable
DCD=up DSR=up DTR=up RTS=up CTS=up
⑵测试网络连通性
routerA#ping 10.1.1.1
Sending 5, 100-byte ICMP Echoes to 10.1.1.1, timeout is 2 seconds:
< press Ctrl+C to break >
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/5 ms
routerA#ping 10.2.2.1
Sending 5, 100-byte ICMP Echoes to 10.2.2.1, timeout is 2 seconds:
< press Ctrl+C to break >
Success rate is 100 percent (5/5), round-trip min/avg/max = 4/4/5 ms
routerA#
routerB#ping 172.16.1.1
Sending 5, 100-byte ICMP Echoes to 172.16.1.1, timeout is 2 seconds:
< press Ctrl+C to break >
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/5/5 ms
routerB#ping 172.16.2.1
Sending 5, 100-byte ICMP Echoes to 172.16.2.1, timeout is 2 seconds:
< press Ctrl+C to break >
Success rate is 100 percent (5/5), round-trip min/avg/max = 5/5/5 ms
routerB#
⑶参考配置
routerA#show running-config
Building configuration...
Current configuration : 853 bytes
version 8.32(building 53)
hostname routerA
interface serial 1/2
ip address 192.168.1.1 255.255.255.0
clock rate 512000
interface serial 1/3
clock rate 64000
interface FastEthernet 1/0
duplex auto
speed auto
interface FastEthernet 1/1
duplex auto
speed auto
interface Loopback 0
ip address 172.16.1.1 255.255.255.0
interface Loopback 1
ip address 172.16.2.1 255.255.255.0
interface Null 0
ip route 10.1.1.0 255.255.255.0 192.168.1.2
ip route 10.2.2.0 255.255.255.0 serial 1/2
line con 0
line aux 0
line vty 0
login
password 7 072c16261f1b22
line vty 1
login
password 7 093d001b2d0c17
line vty 2
login
password 7 0251563e120f3b
line vty 3
login
password 7 08113a1c182e00
line vty 4
login
password 7 0350231914
end
routerB#show running-config
Building configuration...
Current configuration : 881 bytes
version 8.32(building 53)
hostname routerB
interface serial 1/2
ip address 192.168.1.2 255.255.255.0
interface serial 1/3
clock rate 64000
interface FastEthernet 1/0
duplex auto
speed auto
interface FastEthernet 1/1
duplex auto
speed auto
interface Loopback 0
ip address 10.1.1.1 255.255.255.0
interface Loopback 1
ip address 10.2.2.1 255.255.255.0
interface Null 0
ip route 172.16.1.0 255.255.255.0 192.168.1.1
ip route 172.16.2.0 255.255.255.0 serial 1/2
ip route 172.168.1.0 255.255.255.0 192.168.1.1
line con 0
line aux 0
line vty 0
login
password 7 035122110c3706
line vty 1
login
password 7 13170743072817
line vty 2
login
password 7 08113a1c182e00
line vty 3
login
password 7 050a1337092610
line vty 4
login
password 7 1234111358
end
收集于网络,如有侵权请联系管理员删除
展开阅读全文