On 13 Jul 2005,
(E-Mail Removed) <(E-Mail Removed)> wrote:
> "Assuming external internet card is eth0, and external IP is
> 123.12.23.43 and the
> internal network card is eth1, then:
>
> $> modprobe ipt_MASQUERADE # If this fails, try continuing anyway
> $> iptables -F; iptables -t nat -F; iptables -t mangle -F
> $> iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 123.12.23.43
> $> echo 1 > /proc/sys/net/ipv4/ip_forward"
>
><http://www.tldp.org/HOWTO/Masquerading-Simple-HOWTO/summary.html>
>
> unfortunately, this assumption doesn't hold. I'm connecting to the
> internet with
> wi-fi, which is why I need the masquerading. the setup is:
>
> internet => cable modem
> cable modem => router
> router => wi-fi adapter
> wi-fi adapter => arrakis eth0
> arrakis eth0 => arrakis eth1
> arrakis eth1 => hub
> hub => caladan
>
> Arrakis and caladan are the names for two computers. The ISP uses
> DHCP, so arrakis
> eth0 is set to use DHCP, as shown by the following:
You assume arrakis gets a DHCP IP from your ISP, when it is actually
behind an unknown (to us) router (is it broadband NAT router or regular
router?) and unknown (to us) wi-fi connection (is wi-fi from router an AP
or bridge or ad-hoc?). My guess is that arrakis gets a private DHCP IP
from the router, and the public IP you are attempting to masquerade as on
arrakis is not assigned to arrakis and would be rejected by the LAN side
of your router if it was. It appears that your public cable IP has
nothing at all to do with any interfaces or routing at arrakis. You
cannot masquerade as an IP not on that box.
What you should probably do is masquerade anything out eth0 of arrakis as
its eth0 IP (using interface name instead of IP if dynamic). That should
allow caladran to access the internet (since router will see it from
arrakis as a LAN IP it accepts).
Unfortunately my iptables knowledge is incomplete, because SuSEfirewall2
makes it all too easy by just setting variables.