思科常用路由配置

静态路由:

R1(config)#ip route 172.16.2.0 255.255.255.0 192.168.12.2

R1(config)#ip route 172.16.2.0 255.255.255.0 fa0/1

R2(config)#ip route 172.16.1.0 255.255.255.0 192.168.12.1

R2(config)#ip route 172.16.1.0 255.255.255.0 fa0/1

浮动静态路由:

配置静态路由

R1(config)#ip route 172.16.2.0 255.255.255.0 192.168.12.2

R1(config)#ip route 172.16.2.0 255.255.255.0 192.168.120.2

R2(config)#ip route 172.16.1.0 255.255.255.0 192.168.12.1

R2(config)#ip route 172.16.1.0 255.255.255.0 192.168.120.1

修改管理距离

R1(config)#ip route 172.16.2.0 255.255.255.0 192.168.12.2 50

R1(config)#ip route 172.16.2.0 255.255.255.0 192.168.120.2 150

R2(config)#ip route 172.16.1.0 255.255.255.0 192.168.12.1 50

R2(config)#ip route 172.16.1.0 255.255.255.0 192.168.120.1 150

EIGRP配置:

基本配置

R1(config)#router eigrp 100

R1(config-router)#no auto-summary

R1(config-router)#network 192.168.12.0

R1(config-router)#network 192.168.120.0

R1(config-router)#net 172.16.0.0 0.0.255.255

R2(config)#router eigrp 100

R2(config-router)#no auto-summary

R2(config-router)#net 192.168.12.0

R2(config-router)#net 192.168.120.0

R2(config-router)#net 192.168.230.0

R2(config-router)#net 192.168.23.0

R2(config-router)#net 192.168.2.0

R3(config)#router eigrp 100

R3(config-router)#no auto-summary

R3(config-router)#net 192.168.23.0

R3(config-router)#net 192.168.230.0

R3(config-router)#net 192.168.3.0

配置EIGRP 的自动汇总和手工汇总:

开启所有路由器的自动汇总

R1(config)#router eigrp 100

R1(config-router)#auto-summary

R2(config)#router eigrp 100

R2(config-router)#auto-summary

R3(config)#router eigrp 100

R3(config-router)#auto-summary

关闭自动汇总,并在R1上配置手工汇总

R1(config)#router eigrp 100

R1(config-router)#no auto-summary

R1(config)#inter range fa0/0-1

R1(config-if-range)#ip summary-address eigrp 100 172.16.0.0 255.255.252.0

R2(config)#router eigrp 100

R2(config-router)#no auto-summary

R3(config)#router eigrp 100

R3(config-router)#no auto-summary

配置EIGRP不等价负载均衡:

查看 Serial接口默认带宽

R2#show inter s0/3/0

Serial0/3/0 is up, line protocol is up (connected)

Hardware is HD64570

Internet address is 192.168.230.1/24

MTU 1500 bytes, BW 128 Kbit, DLY 20000 usec,

reliability 255/255, txload 1/255, rxload 1/255

(省略部分输出)

Serial接口默认带宽

R2(config)#inter s0/3/0

R2(config-if)#bandwidth 1544

R3(config)#inter s0/3/0

R3(config-if)#bandwidth 1544

配置不等价负载均衡

R2(config)#router eigrp 100

R2(config-router)#variance 15

R3(config)#router eigrp 100

R3(config-router)#variance 15

OSPF配置:

配置单区域OSPF

R1(config)#router ospf 1

R1(config-router)#network 192.168.12.1 0.0.0.0 area 0

R1(config-router)#network 192.168.120.0 0.0.0.255 area 0

R1(config-router)#network 172.16.0.0 0.0.255.255 area 0

R2(config)#router ospf 1

R2(config-router)#router-id 10.2.2.2

R2(config-router)#network 192.168.12.2 0.0.0.0 area 0

R2(config-router)#network 192.168.120.2 0.0.0.0 area 0

R2(config-router)#network 192.168.23.1 0.0.0.0 area 0

R2(config-router)#network 192.168.230.1 0.0.0.0 area 0

R2(config-router)#network 192.168.2.1 0.0.0.0 area 0

R3(config)#router ospf 3

R3(config-router)#network 0.0.0.0 255.255.255.255 area 0

配置多区域OSPF

配置多区域OSPF

R1(config)#router ospf 1

R1(config-router)#network 192.168.12.1 0.0.0.0 area 0

R1(config-router)#network 192.168.120.1 0.0.0.0 area 0

R1(config-router)#net 172.16.0.0 0.0.3.255 area 1

R2(config)#router ospf 1

R2(config-router)#network 192.168.12.2 0.0.0.0 area 0

R2(config-router)#network 192.168.120.2 0.0.0.0 area 0

R2(config-router)#network 192.168.2.1 0.0.0.0 area 0

R2(config-router)#net 192.168.23.1 0.0.0.0 area 2

R2(config-router)#net 192.168.230.1 0.0.0.0 area 2

R3(config)#router ospf 1

R3(config-router)#network 192.168.23.2 0.0.0.0 area 2

R3(config-router)#network 192.168.230.2 0.0.0.0 area 2

R3(config-router)#network 192.168.3.1 0.0.0.0 area 2

配置OSPF 验证

配置明文验证

R1(config)#interface fa0/0

R1(config-if)#ip ospf authentication

R1(config-if)#ip ospf authentication-key ccna

R2(config)#interface fa0/0

R2(config-if)#ip ospf authentication

R3(config-if)#ip ospf authentication-key ccna

配置MD5验证

R2(config)#interface fa0/1

R2(config-if)#ip ospf authentication message-digest

R2(config-if)#ip ospf message-digest-key 1 md5 ccnp

R3(config)#inter fa0/1

R3(config-if)#ip ospf authentication message-digest

R3(config-if)#ip ospf message-digest-key 1 md5 ccnp

配置HSRP

配置单组HSRP

R2(config)#interface fa0/0

R2(config-if)#standby 1 ip 192.168.1.254

R2(config-if)#standby 1 priority 110

R2(config-if)#standby 1 preempt

R3(config)#interface fa0/0

R3(config-if)#standby 1 ip 192.168.1.254

R2(config-if)#standby 1 priority 105

R3(config-if)#standby 1 preempt

R2(config)#interface fa0/0

R2(config-if)#standby 1 track s0/3/0

配置PPP 和验证:

配置PPP单向PAP验证

R1(config)#username ccna password ccna

R1(config)#username ccnp password ccnp

R1(config)#interface s0/0/0

R1(config-if)#encapsulation ppp

R1(config-if)#ppp authentication pap

R2(config)#interface s0/0/0

R2(config-if)#encapsulation ppp

R2(config-if)#ppp pap sent-username ccna password ccna

配置PAP双向验证

R2(config)#username ccna2 password ccna2

R2(config)#interface s0/0/0

R2(config-if)#ppp authentication pap

R1(config)#interface s0/0/0

R1(config-if)#ppp pap sent-username ccna2 password ccna2

配置CHAP单向验证

R2(config)#username R3 password cisco

R2(config)#interface s0/0/1

R2(config-if)#encapsulation ppp

R2(config-if)#ppp authentication chap

R3(config)#username R2 password cisco

R3(config)#interface s0/0/1

R3(config-if)#encapsulation ppp

配置CHAP双向验证

R3(config)#interface s0/0/1

R3(config-if)#ppp authentication chap