On Fri, 10 Jan 2003 01:49:48 +0100
"Andreas Ljunggren" <[EMAIL PROTECTED]> wrote:

> Hi,
> I'm wondering if it's posible to have different internal IP's for
> vservers let's say bound to lo,
> and have them masquraded/NAT'ed via the "external" interface.
> 
> Like:
> eth0      Link encap:Ethernet  HWaddr 00:10:A7:0B:06:44
>           inet addr:213.212.xx.xx  Bcast:213.112.84.127
> Mask:255.255.255.192
>           UP BROADCAST NOTRAILERS RUNNING MULTICAST  MTU:1500  Metric:1
>           RX packets:532 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:520 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:100
>           RX bytes:79286 (77.4 Kb)  TX bytes:48055 (46.9 Kb)
>           Interrupt:5 Base address:0xf000
> 
> lo        Link encap:Local Loopback
>           inet addr:127.0.0.1  Mask:255.0.0.0
>           UP LOOPBACK RUNNING  MTU:16436  Metric:1
>           RX packets:10 errors:0 dropped:0 overruns:0 frame:0
>           TX packets:10 errors:0 dropped:0 overruns:0 carrier:0
>           collisions:0 txqueuelen:0
>           RX bytes:700 (700.0 b)  TX bytes:700 (700.0 b)
> 
> lo:vs1    Link encap:Local Loopback
>           inet addr:10.0.0.1  Mask:255.0.0.0
>           UP LOOPBACK RUNNING  MTU:16436  Metric:1
> 
> I'w tried to turn on IP forwarding, but nothing seams to help.
> 
> Regards
> Andreas
> 

i'm using SNAT instead, also note that acesses to the vserver's dont go
through FORWARD use INPUT/OUTPUT instead

Example:

PPPIP=$(ifconfig ppp0 | head -2 | tail -1 | cut -d ' ' -f 12 | cut -d ':'
-f 2 )
iptables -t nat -A POSTROUTING -o ppp0 -s 10.20.0.0/16 -j SNAT --to-source
$PPPIP

note that this must be called each time ur connection is reestablished and
the IP changed
this is a little bit different than MASQ but works fine for me


cya Christan

Reply via email to