Can next hop address be same as destination address?

2

1

Like if host address is 100.0.0.1 and next hop address is 100.0.0.2 and destination ip address is also 100.0.0.2

Is this a valid use case? Any real life usage?

          <dest ip>                 <next hop>  
ip route 100.0.0.2 255.255.255.255 100.0.0.2 weight 1 next-hop-vrf GlobalRouter

Above is the command on a router inside a VRF. 100.0.0.2 is pingable from host. 100.0.0.1 & 100.0.0.2 are an ip address assigned to a VLAN on host & destination respectively.

On a linux box, Such configuration is valid.

[root]# netstat -r -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
55.55.55.55     55.55.55.55     255.255.255.255 UGH       0 0          0 eth0

[root]# ip route show

55.55.55.55 via 55.55.55.55 dev eth0

As per my understanding, If a destination IP is reachable (i.e in the same subnet of host IP) we dont need a next hop.

I came across one application for using next hop for destination IP in same subnet (i.e for VPN) See this: Will packets send to the same subnet go through routers?

If next hop != destination IP but they are in same subnet as that of host, is a valid scenario for VPN, then i am wondering what are the applications of next_hop==dest_ip & subnet same as host?

This is my first post in Super User. Extremely happy with the quick and warm response.

Raj

Posted 2014-05-28T10:37:23.050

Reputation: 21

Question was closed 2014-05-29T10:03:05.613

How on earth has this got 4 close votes? – barlop – 2014-05-28T12:43:12.310

I notice in my routing table, win7 on a comp with IP of 10.0.0.2 there is a line that says- 10.0.0.2 255.255.255.255 On-link 10.0.0.2 276 I am a bit rusty though. – barlop – 2014-05-28T12:44:39.960

Somebody asked about ARP and that was considered OK. Why not this question? – barlop – 2014-05-28T12:45:23.833

raj, in that last line, is that meant to be a command or is that meant to be output? i either way, better to provide a screenshot so we can see OS and column headings and what it looks like really – barlop – 2014-05-28T14:32:45.230

I just fixed up the formatting. For some reason superuser messes up the formatting of things by default and the thing to do is to highlight some parts where formatting matters and to click the button called "code sample". – barlop – 2014-05-28T21:25:29.240

What is 55.55.55.55? It doesn't look like it'd be an internal ip address (unless you saw an internal address and changed it to that in your post perhaps so people wouldn't no your internal ip though there's no risk there) Or is it to represent an external ip? – barlop – 2014-05-28T21:30:40.293

It is a dummy internal IP addr assigned to eth0:1 of peer node. And hence pingable – Raj – 2014-05-29T05:08:20.453

I've seen TCP/IP networking questions accepted before. You could try serverfault though they s prefer practical questions from administrators. Often people don't understand questions that aren't practical.. moreso here. And TCP/IP is over the heads of a lot pf people. You could try the arstechnica forum, networking section. You will go over the heads of some people there too but they are not as rigid – barlop – 2014-05-29T17:25:12.257

Answers

1

I don't know what ip command you're using, but the next hop can of course be the destination. This is what always happens at the last hop.

If you want a closer example, you can often configure your router by going to its IP (like 192.168.1.1). In this case the next hop is the destination and there is only a single hop.

user2313067

Posted 2014-05-28T10:37:23.050

Reputation: 2 160

I think what he is getting at, is that philosophically, when you're at the destination, there is no 'next hop' because it's not hopping on to another router. But, in networking, if there is a next hop at the destination that lists itself, then Why? I suppose perhaps the answer is that there it is listed as next hop and does indicate it reached the destination. But philosophically it could have sone code that just says Accept and don't route. That is essentially what it is doing. – barlop – 2014-05-28T12:47:09.333

The next hop is not at the destination itself. The device which has a next hop in his question is 100.0.0.1, which has a route to 100.0.0.2 telling it to send the packet directly to 100.0.0.2, because 100.0.0.2 is on the same link so reachable in a single hop. – user2313067 – 2014-05-28T12:50:58.663

At the end of his question he gives another example - the example of "ip route 100.0.0.3 255.255.255.255 100.0.0.3" So in that example he gave there, the next hop is to the same device(computery "router) that the packet just came "in" on. That packet is not going to go anywhere else other than that device. So the destination is the next hop, in that example. – barlop – 2014-05-28T13:02:11.743

When I try his command, it gives me Command "100.0.0.3" is unknown, try "ip route help"., so I don't really know what his command means. I took it to mean route 100.0.0.3/32 via 100.0.0.3 (so on-link). Since the computer/router the command is run on is 100.0.0.1 as far as I understand, the destination is not the sender itself but another machine on the same link, I do not see a problem. – user2313067 – 2014-05-28T13:22:17.057

well what would you make of this output http://i.imgur.com/8jyVf2n.png That is done on a computer with IP 10.0.0.2 and an entry in its routing table has IP 10.0.0.2 in the far left part("incoming"? part), and 10.0.0.2 on the on the far right (next hop part?) (dest=next hop=device its on)

– barlop – 2014-05-28T13:47:39.137

This is for the loopback. If you look at it, you have the same for 127.0.0.1. When you try to access 10.0.0.2 when on that same computer, it has a special route to loopback. On a linux computer, this is in a special routing table accessed via ip route show table local. The far left part is the destination, not the source. – user2313067 – 2014-05-28T13:52:42.020

Let us continue this discussion in chat.

– barlop – 2014-05-28T13:54:27.880

Sorry, it should have been 100.0.0.2 in the command as well. Corrected it – Raj – 2014-05-28T17:58:26.090