[CentOS] Simple routing question

Les Mikesell lesmikesell at gmail.com
Thu Sep 6 15:47:23 EDT 2012


On Thu, Sep 6, 2012 at 2:04 PM, James B. Byrne <byrnejb at harte-lyne.ca> wrote:
>
> What I wanted to have happen was for all traffic destined for
> 192.168.anything to stay inside the LAN and attached to the specified
> address, while any traffic that originated from 192.168.anything
> destined to anywhere else would route through the gateway; where it is
> NAT mangled.

To make that happen on your C host, you need to make the netmask cover
the range of the LAN addresses.  Otherwise it is going to source off
of the other interface and send to the default router.

> I just want to understand what is going on in this specific case
> without delving deeply into the subject of routing, for which I do not
> have the luxury of time.  This not impacting anything of significance
> so I take it up on a time available basis.  On the other hand, I am
> definitely gaining an education in the process.

There is nothing 'deep' about routing. Just convert the addresses and
netmasks to binary and line the bits up.  Where there are 0's in the
netmask bit positions, the destination doesn't have to match; where
there are ones it does. If there are multiple route matches, the most
specific match wins - that will be the one with the most 1's in the
netmask.  Every hop makes this decision independently.

But, it doesn't make sense that ifconfig would show an
interface/netmask that doesn't appear in the route table.  Normally
the system does that automatically.

-- 
   Les Mikesell
     lesmikesell at gmail.com


More information about the CentOS mailing list