Re: Need help with iptables/nat

From: Alex Harsch (infodude_at_gmx.de)
Date: 08/01/04


Date: Sun, 01 Aug 2004 12:58:12 +0200

Mark Richards wrote:

> I'm a seeker of iptables truth and need an expert as I cannot get a
> seemingly simple arrangement working properly. I'll buy the coffee for
> anone who can help!
>
> I am trying to get a simple natting router running on an embedded box. It
> must permit eth0 to be connetec to a cable modem, and eth1 to a pc. The
> intent is to insert the embedded box in the ethernet chain without
> breaking anything. :) Since most clients get an ip dynamically, I've
> installed udhcp in the embedded box.
>
> The setup and more details of the issue are posted here:
> http://www.massmicro.com/grief.html
>
> I'm testing on my local lan (192.168.1.0./24). The embedded box eth0 is
> set to a static IP 192.168.1.90. The box hosts udhcpd so that a client
> connected to the embedded box's eth1 gets an IP address in the range
> 192.168.10.100 - 192.168.10.190. The embedded eth1 is set to
> 192.168.10.254. The client gets its ip fine.
>
> No matter what I do (so far) I can't get from the client through to the
> local lan (and then out to the net). I can ping a www url from the
> embedded box just fine, but from the client I get "Destination Host
> Unreachable".
>
> I'm using a very simple iptables script to begin with. iptables -A
> POSTROUTING -t nat -o eth0 -j MASQUERADE is, I think, correct for this
> case. Along with setting echo 1 > /proc/sys/net/ipv4/ip_forward.
>
> Here's a simple diagram of my setup:
>
> Public Internet
> ADSL Modem
> [dynamic i/p]
> |
> Linksys Router
> [192.168.1.0/24] =Embedded server box=
> |
> 3Com Switch -- > 192.168.1.90 [static/eth0]
> udhcpd
> iptables
> switch < -- 192.168.10.254 [static/eth1]
> |
> client i/p via dhcp 192.168.10.254 [dynamic/eth2]
> Also 192.168.1.80 [static/eth1] -> connected to 3com switch into local
> lan.
>
> As you can see, in my test setup there's double natting going on. First on
> my lan's router, and then on the embedded box. Since I'm bridging between
> different subnets, (risking being called a stupid un-manual reading type)
> I assumed this was perfectly legal.
>
> Can this setup actually work? Am I missing a fundamental here?
Hi,

as Jack already pointed out, there is a default route missing on the
clients. Besides, the 169.254.*.* is something that started out in windows
and it seems to be adapted by some Linux distros like SuSE for example.
DHCP clients, that do not manage to get an IP from a DHCP Server use IPs
from this range to make communication possible in case of a DHCP server
crash. If one of your clients operates with an Ip like this, check your
DHCP server settings. Alex



Relevant Pages

  • Win 2K Server setup
    ... I would appreciate any advice in setting up a Internal soho domain with win ... I have enough understanding to manage something when it is setup, ... The router is configurable to not be a dhcp server and to reserve IP's etc. ... it becomes the dhcp server for the clients, yet gets the benefit of the ...
    (microsoft.public.win2000.networking)
  • Re: Marina Roos Re: sbs2000: problems with exchange
    ... You better setup DHCP on the SBS, it will push all the necessary settings to ... your clients and it is a no-brainer. ... >> Emails are stored in the Exchange server, on the server and that is what ...
    (microsoft.public.backoffice.smallbiz2000)
  • RE: Network configuration
    ... > To: Terrence Koeman ... >> Basically I have no clue what has to be setup etc. and if I ... >> clients and I need ipfw between the clients and the modem. ... -no ipfw rules and default to accept. ...
    (freebsd-questions)
  • Re: SBS2003 setup w/out using POP3 Connector & the Anti-virus implicat
    ... > I setup a SBS2003 Standard Server a bit differently than I usually do. ... > the Inbox which resides on the client's account on the Exchange server. ... > Suite for SMB or Symantec Antivirus with Groupware protection to protect ... > clients and Exchange. ...
    (microsoft.public.windows.server.sbs)
  • Re: Word 2007
    ... I saved that database in each clients directory. ... forms setup to be merge documents. ... I had many choices setup for "if and if ...
    (microsoft.public.word.docmanagement)