R1:
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R1
R1(config)#no ip domain-lookup
R1(config)#line con 0
R1(config-line)#logg syn
R1(config-line)#exec-timeout 00
R1(config-line)#end
*Mar  1 00:17:37.919: %SYS-5-CONFIG_I: Configured from console by console
R1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int lo 0
R1(config-if)#ip add 1.1.1.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#exit
R1(config)#int s0/0
R1(config-if)#ip add 192.168.12.1 255.255.255.0
R1(config-if)#clo r 64000
R1(config-if)#no shut
R1(config-if)#exi


R2:
Router>en
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R2
R2(config)#no ip domain-lookup
R2(config)#line con 0
R2(config-line)#logg syn
R2(config-line)#exec-t
R2(config-line)#exec-timeout 00
R2(config-line)#password cisco
R2(config-line)#login
R2(config-line)#exi
R2(config)#int s0/0
R2(config-if)#ip add 192.168.12.2 255.255.255.0
R2(config-if)#clo r 64000
R2(config-if)#no shut
R2(config-if)#exi
R2(config)#int s0/1
R2(config-if)#ip add 192.168.23.2 255.255.255.0
R2(config-if)#clo r 64000
R2(config-if)#no shut
R2(config-if)#end
R2#pin
*Mar  1 00:23:31.535: %SYS-5-CONFIG_I: Configured from console by consoleg
R2#ping 192.168.12.1Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.12.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 32/50/92 ms

R3:
Router#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
Router(config)#host R3
R3(config)#no ip domain-loo
R3(config)#no ip domain-lookup
R3(config)#line con 0
R3(config-line)#logg syn
R3(config-line)#exec-t
R3(config-line)#exec-timeout 00
R3(config-line)#pass
R3(config-line)#password cisco
R3(config-line)#login
R3(config-line)#exi
R3(config)#int lo 0
*Mar  1 00:38:19.259: %LINEPROTO-5-UPDOWN: Line protocol on Interface Loopback0, changed state to up
R3(config-if)#ip add 2.2.2.2 255.255.255.0
R3(config-if)#no shut
R3(config)#int s0/1
R3(config-if)#ip add 192.168.23.3 255.255.255.0
R3(config-if)#clo r 64000
R3(config-if)#no shut
R3(config-if)#
*Mar  1 00:35:59.567: %LINK-3-UPDOWN: Interface Serial0/1, changed state to up
*Mar  1 00:36:00.567: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/1, changed state to up
R3(config-if)#do ping 192.168.23.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.23.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 28/37/64 ms


现在完成路由器的基本配置,下面配路由协议
静态路由:
R1:
R1(config)#ip route 2.2.2.0 255.255.255.0 192.168.12.2
R1(config)#ip route 192.168.23.0 255.255.255.0 192.168.12.2
R2:
R2(config)#ip route 1.1.1.0 255.255.255.0 192.168.12.1
R2(config)#ip route 2.2.2.0 255.255.255.0 192.168.12.1
R3:
R3(config)#ip route 1.1.1.0 255.255.255.0 192.168.23.2
R3(config)#ip route 192.168.12.0 255.255.255.0 192.168.23.2

测试:
R3#ping 1.1.1.1 source 2.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/71/92 ms

缺省路由:
R1:
R1(config)#ip route 0.0.0.0 0.0.0.0 192.168.12.2
R2:
R2(config)#ip route 1.1.1.0 255.255.255.0 192.168.12.1
R2(config)#ip route 2.2.2.0 255.255.255.0 192.168.12.1
R3:
R3(config)#ip route 0.0.0.0 0.0.0.0 192.168.23.2

 

 

RIP路由:
R1
R1(config)#router rip
R1(config-router)#net 1.1.1.0
R1(config-router)#net 192.168.12.0
R2
R2(config)#router rip

R2(config-router)#net 192.168.12.0
R2(config-router)#net 192.168.23.0
R3
R3(config)#router rip
R3(config-router)#net 2.2.2.0
R3(config-router)#net 192.168.23.0

测试:
R3#ping 1.1.1.1 source 2.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/85/116 ms

eigrp路由:
R1(config)#router eigrp 100
R1(config-router)#net 192.168.12.0 0.0.0.255
*Mar  1 01:32:33.239: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 192.168.12.2 (Serial0/0) is up: new adjacency
R1(config-router)#net 1.1.1.0 0.0.0.255

R2:
R2(config)#router eigrp 100
R2(config-router)#net 192.168.12.0 0.0.0.255
R2(config-router)#net 192.168.23.0 0.0.0.255

R3:
R3(config)#router eigrp 100
R3(config-router)#net 192.168.23.0 0.0.0.255
*Mar  1 01:31:45.239: %DUAL-5-NBRCHANGE: IP-EIGRP(0) 100: Neighbor 192.168.23.2 (Serial0/1) is up: new adjacency
R3(config-router)#net 2.2.2.0 0.0.0.255

测试:
R1#ping 2.2.2.2 source 1.1.1.1

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 2.2.2.2, timeout is 2 seconds:
Packet sent with a source address of 1.1.1.1
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 64/77/112 ms

Ospf路由:
R1(config)#router ospf 100
R1(config-router)#net 1.1.1.0 0.0.0.255 area 0
R1(config-router)#net 192.168.12.0 0.0.0.255 area 0

R2:
R2(config)#router ospf 100
R2(config-router)#net 192.168.12.0 0.0.0.255 area 0
R2(config-router)#net 192.168.23.0 0.0.0.255 area 0

R3:
R3(config)#router ospf 100
R3(config-router)#net 192.168.23.0 0.0.0.255 area 0
*Mar  1 04:07:43.986: %OSPF-5-ADJCHG: Process 100, Nbr 192.168.23.2 on Serial0/1 from LOADING to FULL, Loading Done
R3(config-router)#net 2.2.2.0 0.0.0.255 area 0

测试:
R3#ping 1.1.1.1 source 2.2.2.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
Packet sent with a source address of 2.2.2.2
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 60/77/100 ms