[CentOS] Addressing outgoing connections to a specific interface
rmcconne at lightlink.com
Mon Nov 8 06:12:58 EST 2010
Dotan Cohen wrote:
> On Sat, Nov 6, 2010 at 23:19, Bob McConnell <rmcconne at lightlink.com> wrote:
>> To amplify this just a little bit, by the rules of IP routing, every
>> machine must:
>> A) Have a unique address.
>> B) Be attached to the proper subnet for that address as defined by the
>> local netmask.
>> Once those are true, there exists a unique route between any two
>> machines connected to the network, or the Internet.
> Both those conditions are met in this use case, however the machine in
> question is on two networks:
> A C B
> A: router on the wireless network
> B: router on the wired network
> C: CentOS laptop
> Each router has a unique address on it's own network, as per spec.
> The laptop is connected to two networks, on two different interfaces.
> The networks were never designed to be connected, and in fact there is
> no connection between them.
But by dual homing your laptop on the two subnets simultaneously, you
are breaking those rules. Neither the subnets nor the host address are
unique any longer from the laptop's perspective. It sees two identical
subnets with different routes but cannot reliably determine which subnet
any particular process is trying to reach. In fact, it may even try to
send packets for one socket out the other port when the first port is
busy, thinking it actually has multiple routes to the same subnet.
> Correct me if I'm wrong, but NAT is what C would do to let a computer
> on Network1 access a resource on Network2. C would be the gateway,
> rerouting packets between the two networks and correcting for address
> used on both sides.
No, NAT would simply change the apparent addresses on Network2 to a
space that doesn't conflict with Network1. C is the only common point
and it should never be routing packets between those networks.
> However, I am not trying to create a gateway! In this case, C itself
> (as a workstation) needs to access resources on both networks.
Yes, you are trying to create a gateway for your laptop. You need a
router between C and one of the two networks with NAT capabilities so
that your laptop will see a unique path to each subnet. i.e.
A C B
Now, this could be as simple as a cable router set up for a different
LAN subnet, or it could be a VM on your laptop configured as a router.
That would produce something more like this.
A C B
Nothing in Network2 has to change, but the NAT translates those
addresses into a space that no longer conflicts with Network1. That
restores the uniqueness requirements for your laptop.
More information about the CentOS