[CentOS] Addressing outgoing connections to a specific interface

Dotan Cohen dotancohen at gmail.com
Sat Nov 6 20:05:07 UTC 2010


On Sat, Nov 6, 2010 at 20:51, Lamar Owen <lowen at pari.edu> wrote:
>
> On Nov 6, 2010, at 9:04 AM, Dotan Cohen wrote:
>
>> Both connections have router on  the 192.168.0.1
>> address.
>>
>> Although I need to stay connected to the wireless router, can I still
>> access the address 192.168.0.1 on the wired interface?
>
> What you want is a NAT to take, say, 192.168.1.0/24 and translate it
> to the eth0 192.168.0.0/24 network, where the translation occurs at
> the egress of eth0 (that is, the 192.168.1.0/24 route is set to go out
> eth0, and the egress (and by extension the ingress) traffic gets
> translated.
>
> How you would do this in iptables I'm not sure; I've done it with
> Cisco hardware, as this is a common issue when joining two RFC 1918
> networks together that have overlapping address space.
>
> But at the end you would access 192.168.1.1 and it would get
> translated to 192.168.0.1 at the eth0 point and wouldn't interfere
> with the wlan0 version of the 192.168.0.1 address.  I'm not exactly
> 100% sure it can be done without an external NAT box, but a small
> external router that can do NAT would make it much easier.
>

That is not what I am trying to do, I will try to rephrase:
I have a laptop connected to two network interfaces: eth0 and wlan0.
Each interface connects to a different LAN. Both LANs have machines on
the 192.168.0.1 address that I must access via port 80 in a web
browser.

I don't need to access each one at the same time, but I do need to
leave both interfaces up for other software running on this machine.
CentOS 5.5, Dell Inspiron laptop.

I suppose that I need either:

1) An address system such as eth0:192.168.0.1 and wlan0:192.168.0.1
(syntax invented to illustrate idea, it doesn't really work!)

-or-

2) A way to do something like this as a user without affecting other users:
$ export INTERFACE=eth0
$ lynx 192.168.0.1
$ export INTERFACE=wlan0
$ lynx 192.168.0.1

-or-

3) A pony.


-- 
Dotan Cohen

http://gibberish.co.il
http://what-is-what.com



More information about the CentOS mailing list