在配置静态路由时,如果送出接口为以太口,使用下一跳和送出接口有区别吗
以上拓扑为例:
用送出接口和下一跳分别配置静态路由(R1 和R2 采用相同的配置方式)
1 :路由表显示方式会有差别,但管理距离相同:
R1: show ip route
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, FastEthernet0/0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 [1/0] via 192.168.12.2
用送出接口
Gateway of last resort is not set
C 192.168.12.0/24 is directly connected, FastEthernet0/0
1.0.0.0/24 is subnetted, 1 subnets
C 1.1.1.0 is directly connected, Loopback1
2.0.0.0/24 is subnetted, 1 subnets
S 2.2.2.0 is directly connected, FastEthernet0/0
2:带送出接口的静态路由条目后面直接跟送出接口,路由器只需要一次路由表查找,便能将数据包转发到送出接口,从这点来看 查找路由表效率比带下一跳地址要高,但如果开启了CEF,则不存在此问题.
3 :对于用送出接口的静态路由,如果出站接口为以太网,且关闭了ARP代理,(cisco 在默认情况下以太网接口启用了ARP代理)会造成数据包封装失败,最好使用下一跳来配置.
在R1 F0/0上关闭arp代理(no ip proxy-arp)
R2#debug ip packet
IP packet debugging is on
R2#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
*Mar 1 00:22:10.075: IP: tableid=0, s=192.168.12.2 (local), d=1.1.1.1 (FastEthernet0/0), routed via RIB
*Mar 1 00:22:10.075: IP: s=192.168.12.2 (local), d=1.1.1.1 (FastEthernet0/0), len 100, sending
*Mar 1 00:22:10.075: IP: s=192.168.12.2 (local), d=1.1.1.1 (FastEthernet0/0), len 100, encapsulation failed.
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!