Razvan Cosma wrote:

>   Hello,
>  Any idea on how to get two computers to share the same ip if the linux box
> only has one interface? the basic sheme would be:
> ISP (1.2.3.4)      ----       eth0 (1.2.3.5)        Linux
>                          ---- eth0:0 (192.168.1.1)   box
>                          |
>                          ----(192.168.1.2) box #2

I don't suppose you have a cable or dsl router to the Internet?  Having one of
those that does NAT is the easiest way to do this.

Springing for another ethernet card is easier too (they are as low as $10 here
- maybe not so cheap where you are).

In any case, you have the right idea.  You have to set box #2 so that it uses
192.168.1.1 as its gateway - everything it sends should go there.  Then the
Linux box has to route between 192.168.1.1 and 1.2.3.5 and do its SNAT.  If any
box 2 traffic bypasses box 1, it won't work.

This is quite possible to get working.  The difficulty is in keeping straight
which subnet you are using (you have 2 logical subnets on the same physical
one), and in not getting confused when things don't work.  A sniffer (on the
Linux box, or a third box) might help a lot.


> ping from 192.168.1.2 to 1.2.3.5 :works
> ping from 192.168.1.2 to 1.2.3.4 :timeout :(
>
Here pings to the linux box work - box 2 can see the 1.2.3.5 address because
they are on the same lan segment.

Pings to the outside don't work - the outside doesn't know how to get back to
192.168.1.2, and you aren't routing through the linux box so snat isn't
happening.

> ping www.somwhere.com -I 192.168.1.1 :works
>
In this case, the linux box is probably snating its own address (again, a
sniffer would tell you as would detailed iptables logs).  Obviously its own
packets go through its filters.

You may have to adjust some of the ipv4 settings since the linux box will be
routing things in and out the same interface (which isn't a normal config).

HTH, ask back if you're still stuck.  Or look at the various networking howtos
for routing info.

Dave


_______________________________________________
Linux-users mailing list
Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users

Reply via email to