1

Does it mean the next hop of the route? Can the gateway be the next next hop, if there is an internal router in the private network?

4 Answers 4

4

Does it mean the next hop of the route?

Yes, it means the next hop of the route.

Can the gateway be the next next hop, if there is an internal router in the private network

You could do that, but you must specify the route from host to gateway must go through the internal router

Example:

Host(192.168.1.10) ---> (192.168.1.1)Router(172.16.1.2) ---> (172.16.1.1)Gateway ---> NET

Then you will config in host like this:
route add -host 172.16.1.1 gw 192.168.1.1
route add default gw 172.16.1.1
3
  • Welcome to SF, Gnouc. This is a beautiful answer.
    – dotancohen
    May 7, 2013 at 5:07
  • Huh? default gateway must be from local network, that route command should fail . Even if you can add it, it won't work as you imagine since the middle router would reroute packets as he wants, and not as you define on your host (because IP packets don't contain the route they want to go, middle router has no way knowing what you want) May 7, 2013 at 20:50
  • No, default gateway must not be from local network. Have you tried this in lab? You can do something like this: - Machine 1: IP 192.168.1.2 gateway 172.16.1.1 - Machine 2: IP 172.16.1.1 gateway 192.168.1.1 Two machine using VMnet2 ( Using VMWare ), then from Machine 1 ping Machine 2. What happen?
    – cuonglm
    May 8, 2013 at 2:15
0

Every time when an IP packet passes a router/gateway hop count is decremented. And this is independent from internal/external routers. The reason is to prevent packages to be ping-pong for ever, for example, if router A routes package to router B, while router B routes the same package to router A. The packet is 'killed' then hop count equals to zero. BTW, this is the way how traceroute command works.

0

The original Internet people talked about "gateway", a term the OSI people took to mean something else, and named that thing a "router". Much Unix lore still talks about "gateways" for what more acuurately is "router".

(A "gateway" translates between protocols, i.e. Internet mail to IBM's stuff on CMS, and so on. But the Internet protocols are ubiquous today, so true gateways are far in between).

0

think of it this way:

Router A has two networks, Port A 10.5.5.1/24 and Port B 10.2.2.2/24 Router B has two networks, Port A 10.2.2.1/24 and Port B 10.2.2.1/24

now lets say you connect Port B of Router A to Port B of Router B, You would be able to "see" Router A from Router B with no problems, however, Router B cannot see the network 10.5.5.1 on Router A by default.

To set it up correctly, you would have to create routes like this:

In Router B: route add 10.5.5.0 255.255.255.0 10.2.2.2 (where 10.2.2.2 is the gateway IP to the 10.5.5.0 network).

You'd also have to set it up the other way around as well!

In Router A: route add 10.2.2.0 255.255.255.0 10.5.5.1 (where 10.5.5.1 is the gateway IP to the 10.2.2.0 network).

Hope this helps

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .