Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.networking > #4372 > unrolled thread

Quick question about routing

Started byszr <szr@sREzMOrVEoman.com>
First post2019-04-26 19:17 -0700
Last post2019-04-27 08:03 -0700
Articles 5 — 4 participants

Back to article view | Back to comp.os.linux.networking


Contents

  Quick question about routing szr <szr@sREzMOrVEoman.com> - 2019-04-26 19:17 -0700
    Re: Quick question about routing William Unruh <unruh@invalid.ca> - 2019-04-27 03:02 +0000
    Re: Quick question about routing Pascal Hambourg <pascal@plouf.fr.eu.org> - 2019-04-27 09:14 +0200
      Re: Quick question about routing Theodore Heise <theise@panix.com> - 2019-04-27 14:28 +0000
      Re: Quick question about routing szr <szr@sREzMOrVEoman.com> - 2019-04-27 08:03 -0700

#4372 — Quick question about routing

Fromszr <szr@sREzMOrVEoman.com>
Date2019-04-26 19:17 -0700
SubjectQuick question about routing
Message-ID<qa0e4d0egm@news2.newsguy.com>
Ok, I have a LAN with the following notes:

192.168.1.254 - Main router / default gateway for LAN
192.168.1.4   - Linux server (eth0)
192.168.1.8   - Windows laptop

Linux server (192.168.1.4) has ip(v4) forwarding enabled.

As an experiment I added an ip, 10.0.0.4, as eth0:0.

Then I added a static route for 10.0.0.0/8 using 192.168.1.4 as the 
gateway on the main router.

After that, I ran `ping 10.0.0.4` from the Windows laptop and the ping 
was successful.

While I do have plenty of networking experience and I'm not surprised 
that this worked, one thing sort of bugs me.

I'm able to ping an ip in the 10.0.0.0/8 subnet from a host that only 
has an ip in the 192.168.1.0/24 subnet. I know that the laptop is using 
the route from the default gateway (the main router) but how exactly is 
the ping getting back when the source of the ping isn't coming from 
another 10.0.0.0/8 address? Is this more due to ip forwarding, or 
because it's on the same physical network segment?

Again, I otherwise have a very good understanding of networking, but I 
can't seem to resolve this scenario completely in my mind, and would 
really like to know what exactly is happening here that allows the round 
trip to occur successfully.

-- 
szr

[toc] | [next] | [standalone]


#4373

FromWilliam Unruh <unruh@invalid.ca>
Date2019-04-27 03:02 +0000
Message-ID<qa0go0$s1v$1@dont-email.me>
In reply to#4372
On 2019-04-27, szr <szr@sREzMOrVEoman.com> wrote:
> Ok, I have a LAN with the following notes:
>
> 192.168.1.254 - Main router / default gateway for LAN
> 192.168.1.4   - Linux server (eth0)
> 192.168.1.8   - Windows laptop
>
> Linux server (192.168.1.4) has ip(v4) forwarding enabled.
>
> As an experiment I added an ip, 10.0.0.4, as eth0:0.
>
> Then I added a static route for 10.0.0.0/8 using 192.168.1.4 as the 
> gateway on the main router.
>
> After that, I ran `ping 10.0.0.4` from the Windows laptop and the ping 
> was successful.
>
> While I do have plenty of networking experience and I'm not surprised 
> that this worked, one thing sort of bugs me.
>
> I'm able to ping an ip in the 10.0.0.0/8 subnet from a host that only 
> has an ip in the 192.168.1.0/24 subnet. I know that the laptop is using 
> the route from the default gateway (the main router) but how exactly is 
> the ping getting back when the source of the ping isn't coming from 
> another 10.0.0.0/8 address? Is this more due to ip forwarding, or 
> because it's on the same physical network segment?
>
> Again, I otherwise have a very good understanding of networking, but I 
> can't seem to resolve this scenario completely in my mind, and would 
> really like to know what exactly is happening here that allows the round 
> trip to occur successfully.
>

Do
route -n
on the various machines. I suspect that you will have something like 
192.168.1.0     0.0.0.0 ...
10.8.0.0        0.0.0.0 ...
These say--If you get and address which, when anded with the mask give
thos addresses, just send the packet onto the network connected to the
machine-- well actually, it sends out a request onto the local network
sayins "Who has 10.8.0.5" and the machine that has that address sends
back and says "I, who has MAC address 23:55:12:ac:0d, have that address"
and your machine sends out a packet addressed to that MAC address.

[toc] | [prev] | [next] | [standalone]


#4374

FromPascal Hambourg <pascal@plouf.fr.eu.org>
Date2019-04-27 09:14 +0200
Message-ID<qa0vg7$7av$1@saria.nerim.net>
In reply to#4372
Le 27/04/2019 à 04:17, szr a écrit :
> Ok, I have a LAN with the following notes:
> 
> 192.168.1.254 - Main router / default gateway for LAN
> 192.168.1.4   - Linux server (eth0)
> 192.168.1.8   - Windows laptop
> 
> Linux server (192.168.1.4) has ip(v4) forwarding enabled.

Note : IP forwarding is not involved in your scenario.

> As an experiment I added an ip, 10.0.0.4, as eth0:0.

Note : use of eth0:0 alias is deprecated. You can just add multiple 
addresses to eth0.

> Then I added a static route for 10.0.0.0/8 using 192.168.1.4 as the 
> gateway on the main router.
> 
> After that, I ran `ping 10.0.0.4` from the Windows laptop and the ping 
> was successful.
> 
> While I do have plenty of networking experience and I'm not surprised 
> that this worked, one thing sort of bugs me.
> 
> I'm able to ping an ip in the 10.0.0.0/8 subnet from a host that only 
> has an ip in the 192.168.1.0/24 subnet. I know that the laptop is using 
> the route from the default gateway (the main router)

No. A routing table is local. The laptop just uses its own routing 
table. So does any other involved node (host or router) in the path.

The laptop routing table has 2 routes :
192.168.1.0/24 direct
0.0.0.0/0 via 192.168.1.254

10.0.0.4 does not match the first route so use the default route and 
send to the router.

The router routing table has 3 routes :
192.168.1.0/24 direct
10.0.0.0/8 via 192.168.1.4
0.0.0.0/0 via some external ISP router

10.0.0.4 matches the second route so forward to 192.168.1.4 (server).

[Note : the router may also send an ICMP "redirect" message to the 
laptop to inform it that 10.0.0.4 is directly reachable on the network 
segment, and the laptop may update its routing table to reflect this so 
that it sends subsequent packets to 10.0.0.4 directly to the server.]

The server routing table has 3 routes :
192.168.1.0/24 direct
10.0.0.0/8 direct
0.0.0.0/0 via 192.168.1.254

10.0.0.4 is assigned to a local interface so accept the packet and reply 
to the source 192.168.1.8 (laptop).
192.168.1.8 matches the first route so send directly to the laptop.

> but how exactly is 
> the ping getting back when the source of the ping isn't coming from 
> another 10.0.0.0/8 address? Is this more due to ip forwarding, or 

No. As I wrote, no IP forwarding is involved on the server because the 
destination is the host itself. It is just acting as a host with 
multiple addresses.

> because it's on the same physical network segment?

Not really. It would work even if the source was in a distinct network 
segment. The server would just send the reply back to the router and the 
router would forward it to the other network segment.

[toc] | [prev] | [next] | [standalone]


#4375

FromTheodore Heise <theise@panix.com>
Date2019-04-27 14:28 +0000
Message-ID<slrnqc8poa.71s.theise@panix2.panix.com>
In reply to#4374
On Sat, 27 Apr 2019 09:14:14 +0200,
  Pascal Hambourg <pascal@plouf.fr.eu.org> wrote:
>  Le 27/04/2019 ?? 04:17, szr a ??crit??:
> > Ok, I have a LAN with the following notes:
> > 
> > 192.168.1.254 - Main router / default gateway for LAN
> > 192.168.1.4???? - Linux server (eth0)
> > 192.168.1.8???? - Windows laptop
> > 
> > Linux server (192.168.1.4) has ip(v4) forwarding enabled.
> 
>  Note : IP forwarding is not involved in your scenario.
> 
> > As an experiment I added an ip, 10.0.0.4, as eth0:0.
> 
>  Note : use of eth0:0 alias is deprecated. You can just add 
>  multiple addresses to eth0.
> 
> > Then I added a static route for 10.0.0.0/8 using 192.168.1.4 
> > as the gateway on the main router.
> > 
> > After that, I ran `ping 10.0.0.4` from the Windows laptop and 
> > the ping was successful.
> > 
> > While I do have plenty of networking experience and I'm not 
> > surprised that this worked, one thing sort of bugs me.
> > 
> > I'm able to ping an ip in the 10.0.0.0/8 subnet from a host 
> > that only has an ip in the 192.168.1.0/24 subnet. I know that 
> > the laptop is using the route from the default gateway (the 
> > main router)
> 
>  No. A routing table is local. The laptop just uses its own 
>  routing table. So does any other involved node (host or router) 
>  in the path.
> 
>  The laptop routing table has 2 routes :
>  192.168.1.0/24 direct
>  0.0.0.0/0 via 192.168.1.254
> 
>  10.0.0.4 does not match the first route so use the default route and 
>  send to the router.
> 
>  The router routing table has 3 routes :
>  192.168.1.0/24 direct
>  10.0.0.0/8 via 192.168.1.4
>  0.0.0.0/0 via some external ISP router
> 
>  10.0.0.4 matches the second route so forward to 192.168.1.4 
>  (server).
> 
>  [Note : the router may also send an ICMP "redirect" message to 
>  the laptop to inform it that 10.0.0.4 is directly reachable on 
>  the network segment, and the laptop may update its routing 
>  table to reflect this so that it sends subsequent packets to 
>  10.0.0.4 directly to the server.]
> 
>  The server routing table has 3 routes :
>  192.168.1.0/24 direct
>  10.0.0.0/8 direct
>  0.0.0.0/0 via 192.168.1.254
> 
>  10.0.0.4 is assigned to a local interface so accept the packet and reply 
>  to the source 192.168.1.8 (laptop).
>  192.168.1.8 matches the first route so send directly to the laptop.

Very clear explanation, thank you!

-- 
Ted Heise      <theise@panix.com>       West Lafayette, IN, USA

[toc] | [prev] | [next] | [standalone]


#4376

Fromszr <szr@sREzMOrVEoman.com>
Date2019-04-27 08:03 -0700
Message-ID<qa1qvi0287n@news3.newsguy.com>
In reply to#4374
On 4/27/2019 0:14 AM, Pascal Hambourg wrote:
> Le 27/04/2019 à 04:17, szr a écrit :
>> Ok, I have a LAN with the following notes:
>>
>> 192.168.1.254 - Main router / default gateway for LAN
>> 192.168.1.4   - Linux server (eth0)
>> 192.168.1.8   - Windows laptop
>>
>> Linux server (192.168.1.4) has ip(v4) forwarding enabled.
>
> Note : IP forwarding is not involved in your scenario.
>
>> As an experiment I added an ip, 10.0.0.4, as eth0:0.
>
> Note : use of eth0:0 alias is deprecated. You can just add multiple
> addresses to eth0.
>
>> Then I added a static route for 10.0.0.0/8 using 192.168.1.4 as the
>> gateway on the main router.
>>
>> After that, I ran `ping 10.0.0.4` from the Windows laptop and the ping
>> was successful.
>>
>> While I do have plenty of networking experience and I'm not surprised
>> that this worked, one thing sort of bugs me.
>>
>> I'm able to ping an ip in the 10.0.0.0/8 subnet from a host that only
>> has an ip in the 192.168.1.0/24 subnet. I know that the laptop is
>> using the route from the default gateway (the main router)
>
> No. A routing table is local. The laptop just uses its own routing
> table. So does any other involved node (host or router) in the path.
>
> The laptop routing table has 2 routes :
> 192.168.1.0/24 direct
> 0.0.0.0/0 via 192.168.1.254
>
> 10.0.0.4 does not match the first route so use the default route and
> send to the router.
>
> The router routing table has 3 routes :
> 192.168.1.0/24 direct
> 10.0.0.0/8 via 192.168.1.4
> 0.0.0.0/0 via some external ISP router
>
> 10.0.0.4 matches the second route so forward to 192.168.1.4 (server).
>
> [Note : the router may also send an ICMP "redirect" message to the
> laptop to inform it that 10.0.0.4 is directly reachable on the network
> segment, and the laptop may update its routing table to reflect this so
> that it sends subsequent packets to 10.0.0.4 directly to the server.]
>
> The server routing table has 3 routes :
> 192.168.1.0/24 direct
> 10.0.0.0/8 direct
> 0.0.0.0/0 via 192.168.1.254
>
> 10.0.0.4 is assigned to a local interface so accept the packet and reply
> to the source 192.168.1.8 (laptop).
> 192.168.1.8 matches the first route so send directly to the laptop.
>
>> but how exactly is the ping getting back when the source of the ping
>> isn't coming from another 10.0.0.0/8 address? Is this more due to ip
>> forwarding, or
>
> No. As I wrote, no IP forwarding is involved on the server because the
> destination is the host itself. It is just acting as a host with
> multiple addresses.
>
>> because it's on the same physical network segment?
>
> Not really. It would work even if the source was in a distinct network
> segment. The server would just send the reply back to the router and the
> router would forward it to the other network segment.


Thanks, this all makes complete sense now. I must have been a bit tired 
as my mind was somehow crossing up this with trying to reach hosts 
behind a masqueraded ip, vlan, or some similar scenario. Just one of 
those cases where after a good nights rest it all becomes clear. Thanks 
again.

-- 
szr

[toc] | [prev] | [standalone]


Back to top | Article view | comp.os.linux.networking


csiph-web