On the machine that is configured for 1.2.3.5
ifconfig eth0:0 192.168.1.1 netmask 255.255.255.0
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -j MASQUERADE

On the machine that is configured for 192.168.1.2, make its default gateway 192.168.1.1

SNAT is for Statically NATting the source address.
DNAT is for Statically NATting the destination address.
You may overload an ip address, but it acts as loadbalancing, not sharing.

Masquerading acts more like PAT (port address translation).  The MASQERADE-ing machine 
handles the address sharing.

Matt

> ----- Original Message -----
> From: "Razvan Cosma" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, November 27, 2001 7:35 PM
> Subject: router with one interface
> 
> 
> >   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 have tried
> > iptables -t nat -A POSTROUTING -s 192.168.1.0/255 -j SNAT --to-source
> > 1.2.3.5
> > ping from 192.168.1.2 to 1.2.3.5 :works
> > ping from 192.168.1.2 to 1.2.3.4 :timeout :(
> >
> > ping www.somwhere.com -I 192.168.1.1 :works
> > /proc/sys/net/ipv4/ip_forward:1
> > all necessary modules loaded
> >
> > still..?
> >
> >
> 
> _______________________________________________
> Linux-users mailing list
> Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users
_______________________________________________
Linux-users mailing list
Archives, Digests, etc at http://linux.nf/mailman/listinfo/linux-users

Reply via email to