总结一下昨天学到的东西,防止忘了!
大概是几种路由的方式:有静态路由,RIP路由,EIGRP路由.
其中RIP路由又包括version 1 & version 2(默认是version 1,如果写version 2 一般还会加上no-auto summary)
RIP路由 不能超过16个跳点
基本命令:
router rip
network 192.168.12.0 //地址写的是网段地址
本身rip是自动归类的(version1).
如果想实现不自动归类,需要做如下设置
- version 2
- no auto-summary
EIGRP路由
router eigrp 进程号(0-65535)
network 网络号 子网掩码的反码
如:
router eigrp 100
network 192.168.1.0 0.0.0.255
几点注意:如果要实现网络互通,进程号必须要相同
A. 只用rip路由的话,用show ip route 查看路由表是这样的
R1:
R1#show ip route
Codes: 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
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Ethernet0/1
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
R 2.0.0.0/8 [120/1] via 192.168.12.2, 00:00:23, Ethernet0/1
R 3.0.0.0/8 [120/2] via 192.168.12.2, 00:00:23, Ethernet0/1
R 192.168.23.0/24 [120/1] via 192.168.12.2, 00:00:23, Ethernet0/1
R2:
R2#show ip route
Codes: 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
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Ethernet0/0
R 1.0.0.0/8 [120/1] via 192.168.12.1, 00:00:01, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
R 3.0.0.0/8 [120/1] via 192.168.23.3, 00:00:14, Ethernet0/1
C 192.168.23.0/24 is directly connected, Ethernet0/1
R3:
R3#show ip route
Codes: 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
Gateway of last resort is not set
R 192.168.12.0/24 [120/1] via 192.168.23.2, 00:00:21, Ethernet0/0
R 1.0.0.0/8 [120/2] via 192.168.23.2, 00:00:21, Ethernet0/0
R 2.0.0.0/8 [120/1] via 192.168.23.2, 00:00:21, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.168.23.0/24 is directly connected, Ethernet0/0
其中[]里面,/前面表示的是管理距离,越小越优先
/后面的表示的是跳数,表示经过几跳能到达目的地.
B.如果加入静态路由的话
R1:
R1#show ip rou
*Mar 1 01:02:55.583: %SYS-5-CONFIG_I: Configured from console by consolete
Codes: 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
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Ethernet0/1
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 2.2.2.0/24 [1/0] via 192.168.12.2
R 2.0.0.0/8 [120/1] via 192.168.12.2, 00:00:22, Ethernet0/1
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 3.3.3.0/24 [1/0] via 192.168.12.2
R 3.0.0.0/8 [120/2] via 192.168.12.2, 00:00:22, Ethernet0/1
S 192.168.23.0/24 [1/0] via 192.168.12.2
R2:
R2#show
*Mar 1 01:02:46.155: %SYS-5-CONFIG_I: Configured from console by consoleip rout
e
Codes: 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
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Ethernet0/0
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 1.1.1.0/24 [1/0] via 192.168.12.1
R 1.0.0.0/8 [120/1] via 192.168.12.1, 00:00:25, Ethernet0/0
2.0.0.0/24 is subnetted, 1 subnets
C 2.2.2.0 is directly connected, Loopback0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 3.3.3.0/24 [1/0] via 192.168.23.3
R 3.0.0.0/8 [120/1] via 192.168.23.3, 00:00:12, Ethernet0/1
C 192.168.23.0/24 is directly connected, Ethernet0/1
R3:
R3#show ip route
Codes: 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
Gateway of last resort is not set
S 192.168.12.0/24 [1/0] via 192.168.23.2
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 1.1.1.0/24 [1/0] via 192.168.23.2
R 1.0.0.0/8 [120/2] via 192.168.23.2, 00:00:07, Ethernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
S 2.2.2.0/24 [1/0] via 192.168.23.2
R 2.0.0.0/8 [120/1] via 192.168.23.2, 00:00:07, Ethernet0/0
3.0.0.0/24 is subnetted, 1 subnets
C 3.3.3.0 is directly connected, Loopback0
C 192.168.23.0/24 is directly connected, Ethernet0/0
注意:之所以到达2.2.2.2的时候会有R,也有S是因为rip默认是归类的,他会把2.2.2.0 自动归类为a类,即2.0.0.0 /8,所以R到这的路由并没有被s替代.
C.eigrp(Cisco路由器独有)
只用eigrp连通的话
R1:
!
router eigrp 100
network 1.1.1.0 0.0.0.255
network 192.168.12.0
auto-summary
!
R2:
!
router eigrp 100
network 2.2.2.0 0.0.0.255
network 192.168.12.0
network 192.168.23.0
auto-summary
!
R3:
!
router eigrp 100
network 3.3.3.0 0.0.0.255
network 192.168.23.0
auto-summary
!
如果使用show ip route 看的话
R1
r1(config-router)#do show ip route
Codes: 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
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Ethernet0/1
1.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 1.1.1.0/24 is directly connected, Loopback1
D 1.0.0.0/8 is a summary, 00:12:54, Null0
D 2.0.0.0/8 [90/409600] via 192.168.12.2, 00:11:20, Ethernet0/1
D 3.0.0.0/8 [90/435200] via 192.168.12.2, 00:10:29, Ethernet0/1
D 192.168.23.0/24 [90/307200] via 192.168.12.2, 00:11:31, Ethernet0/1
R2
r2(config)#do show ip route
Codes: 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
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, Ethernet0/0
D 1.0.0.0/8 [90/409600] via 192.168.12.1, 00:12:47, Ethernet0/0
2.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 2.2.2.0/24 is directly connected, Loopback1
D 2.0.0.0/8 is a summary, 00:12:05, Null0
D 3.0.0.0/8 [90/409600] via 192.168.23.3, 00:11:14, Ethernet0/1
C 192.168.23.0/24 is directly connected, Ethernet0/1
R3:
r3(config-router)#do show ip route
Codes: 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
Gateway of last resort is not set
D 192.168.12.0/24 [90/307200] via 192.168.23.2, 00:12:04, Ethernet0/0
D 1.0.0.0/8 [90/435200] via 192.168.23.2, 00:12:04, Ethernet0/0
D 2.0.0.0/8 [90/409600] via 192.168.23.2, 00:12:04, Ethernet0/0
3.0.0.0/8 is variably subnetted, 2 subnets, 2 masks
C 3.3.3.0/24 is directly connected, Loopback1
D 3.0.0.0/8 is a summary, 00:11:42, Null0
C 192.168.23.0/24 is directly connected, Ethernet0/0
如果再eigrp的基础上,加上rip路由的话,路由表不会改变,因为rip的优先级是120比eigrp低,同时对于1.1.1.1这类地址都会自动归类,所以eigrp还是会覆盖掉rip路由!
如果在此基础上再加上静态路由,则对于1.1.1.1这类地址既有静态也有eigrp存在,对于192.168.12.0这类网段只有静态存在!
本文出自 “技术盛宴” 博客,转载请与作者联系!