【转】 Difference between defining static routes with next-hop address or exit interface

For a long time I was confused about this. It was not clear to me what is the difference between setting the static route using next hop interface IP address instead of exit interface (outgoing interface) syntax. It seemed that both methods are the same and that you have basically two different ways to define static route on specific device for no particular reason.

It was not clear to me why would someone do this kind of option on networking device OS if there were no reason for doing so. In other words I was strongly convinced that there must be some difference between two configs and learning more detail about the process of routers recursive searches and Proxy ARP function did answer all my doubts.

So now is time to put it all on paper for you to see it:

YOU CAN DEFINE STATIC ROUTE LIKE THIS:

R1(config)#ip route 10.0.0.0 255.255.255.0 10.10.2.1

This means that all packets from R1 with destination address from 10.0.0.0/24 subnet will be forwarded out the interface leading to next hop device with 10.10.2.1 address on its interface.

Other way is to define the same static route like this:

R1(config)#ip route 10.0.0.0 255.255.255.0 fastEthernet 0/0

If fastEthernet 0/0 is the interface on R1 router that leads to next hop router with best path to 10.0.0.0/24

WHAT’S THE DIFFERENCE, WHICH IS BETTER?

If you use next-hop address, you can conclude that your router will not have the information which interface must he use in order to route those packets out towards destination. R1 must then find an interface that is having 10.10.2.1 on other side. If there is no such interface the router will not install this static route into forwarding table. Second thing that is also important, if the router finds the outbound interface, it will check if this is multipoint interface or point-to-point interface. If this is a multipoint interface then the router needs to find layer 2 address of 10.10.2.1 so it can send the packets only to one specific neighbor on that segment. That is the case with Ethernet segment. On Ethernet segment the router will use ARP to find layer 2 MAC address of 10.10.2.1 and it will use that MAC address for all packets destined to any address from 10.0.0.0/24 range.

If you use outgoing interface, the router doesn’t need to do recursive lookup to find outgoing interface because it is written in the route. But the router doesn’t know which layer 2 neighbour address exist on that link. If we are speaking about Ethernet or some other multipoint interfaces, to get this information router needs to make layer 2 lookup for the final destination. It means that the router needs to find MAC address of let’s say 10.0.0.1 and not from 10.10.2.1

It furthermore means that router will need to have layer 2 (MAC) address resolved for every host from 10.0.0.0/24 and you will need proxy-ARP for this to be possible on Ethernet segments. When we see this it is clear that we should not use this kind of configuration on multipoint interfaces but only on point-to-point segments. If some interface is point-to-point then there is only one host on the other side and then there is no layer 2 resolution needed. PPP or HDLC are not having MAC addresses in their headers! In this case outgoing interface is better option so our router does not need to do recursive lookup to get the outgoing interface from next-hop address.

DEFAULT ROUTING THE RIGHT WAY

If you have default route defined with next-hop you are making right configuration choice. In this way you will need to have only one MAC resolved to all unknown destinations in ARP table. ARP will get your router the MAC of the next hop and all future ARP request will already have that answer in ARP cache.

If you have default route defined with outgoing interface you will possibly have some issues. Router does not have next-hop IP address nor destination MAC address. The router will need Proxy ARP response from his default neighbor router. Using Proxy ARP, ARP table will have many entries pointing to same MAC. Router will actually build the ARP entry every time MAC for unknown destination is needed. Little later ARP table will grow so huge that it will be filled up. When that happens there will be some ARP timeout and connection issues. And yes, one more thing. If proxy ARP is not working and that can easily be the case all this will not work at all.

时间: 2024-10-12 03:20:47

【转】 Difference between defining static routes with next-hop address or exit interface的相关文章

4.2 Routing -- Defining Your Routes

一.概述 1. 当应用程序启动时,路由器负责显示模板,加载数据,另外还设置应用程序的状态.这是通过匹配当前URL到你定义的routes来实现的. 2. Ember app router中的Map方法可以被调用来定义URL映射.当调用Map时,你应该传递一个function,它将会被调用,this会被设置为一个对象,你可以用它来创建路由. app/router.js Router.map(function() { this.route('about', { path: '/about' }); t

静态,关键字:static 接口,IUSB , API 接口关键字:interface

//静态 //普通成员 //普通成员是属于对象的 //静态成员 //静态成员属于类的 //关键字:static //self关键字:在类里面代表该类 //在静态方法里面不能调用普通成员 //在普通方法里面能够调用静态成员 //.$this代表该对象,需要用对象去调用它,不能用类名调用!说明了一个情况:在静态方法里面不能调用普通成员 class FenBi { public $length; //粉笔的长度 public static $color; //粉笔的颜色 static function

路由协议的优先级,以及管理距离AD和metric的区别

路由协议的优先级(Preference,即管理距离Administrative Distance)一般为一个0到255之间的数字,数字越大则优先级越低.表一是通常情况下各路由协议的优先级规定: 表一:一般路由协议优先级 路由协议 优先级 DIRECT 0 OSPF 10 IS-IS Level 1 15 IS-IS Level 2 18 NSFnet主干的SPF 19 缺省网关和EGP缺省 20 重定向路由 30 由route socket得到的路由 40 由网关加入的路由 50 路由器发现的路

Supporting Connected Routes to Subnet Zero

Supporting Connected Routes to Subnet Zero IOS allows the network engineer to tell a router to either allow addresses in the zero subnet or not. The motivation has to do with some older IP routing protocols that did not support the use of the zero su

HOWTO: multiple default routes

Thanks to phoenix help I was able to setup multiple default routes, or a default route per network/interface to be precise, in Debian/Linux it is as simple as that: /etc/network/interfaces Code: iface eth0 inet static address 10.0.0.1 netmask 255.255

给ubuntu设置静态ip —— How to set static IP Address in Ubuntu Server 16.04

原文: http://www.configserverfirewall.com/ubuntu-linux/ubuntu-set-static-ip-address/ ------------------------------------------------------------------------------------------------- How to set static IP Address in Ubuntu Server 16.04 It is really impo

static用法

static-静态变量 如下代码,使用了静态变量和全局变量 #include <stdio.h> #include <stdlib.h> float weight = 1.2; //全局变量 static float high = 1.2;//静态变量 void showCookTimeForTurkey(int pounds){     int necessaryTime = 15 + 15* pounds;     printf("cook for %d min&qu

面向对象基础——static关键字和代码块的使用

具体内容 在Java中可以使用static声明属性和方法,因为之前多部分属性和方法都属于非static的,这样一来,每个对象都占有自己的内容,如果现在希望一个属性被所有的对象所共同拥有,则可以将其声明为static类型,声明为static类型的属性和方法之后此属性或方法也称为类非,可以由类名称直接调用. 使用static声明属性 static可以声明全局属性,全局属性到底有哪些作用?如下所示 class Person{ // 定义Person类 String name ; // 定义name属性

Java static,final 基本概念

(转载自http://blog.kenyang.net/2011/03/java-staticfinal.html) 從很久以前我就了解到, 不僅僅要知道know how, 還要知道know why, 舉個例子,當我派工作給底下的人做時, 例如要他做出一個發送mail的功能出來, 恩,拜Google大神所賜,通常很快都可以找到發送mail的code. 但是當我細下去問每一行code的用途時, 大多是...."恩...不知道". 我覺得此風不可長. 甚至有些學弟們搞不清楚何時要用stat