Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Mike Wright <mike.wright@mailinator.com>
To: Pawel Karpowicz <mafeuser@gmail.com>
Cc: netfilter@vger.kernel.org
Subject: Re: simple/ubiquitous iptables NAT config no longer works
Date: Wed, 26 Oct 2011 10:51:03 -0700	[thread overview]
Message-ID: <4EA84887.7090005@mailinator.com> (raw)
In-Reply-To: <CAA+mFXP0v2TxRxz0RDWfvwxX5zGG_QPMLygSbQM_tyZ6vLBALg@mail.gmail.com>

On 10/26/2011 10:22 AM, Pawel Karpowicz wrote:
> I didn't get the help so maybe I should ask someone for simple NAT
> configuration for iptables v.1.4.10?
>
>> my ubuntu plays role of simple router. It has 2 interfaces
>> eth0(public), eth1(private):
>>
>> eth0      Link encap:Ethernet  HWaddr 00:18:8b:04:8a:13
>>           inet addr:89.73.128.70  Bcast:255.255.255.255  Mask:255.255.252.0
>>           UP BROADCAST RUNNING MULTICAST  MTU:576  Metric:1
>>           RX packets:8535 errors:0 dropped:0 overruns:0 frame:0
>>           TX packets:4873 errors:0 dropped:0 overruns:0 carrier:0
>>           collisions:0 txqueuelen:1000
>>           RX bytes:3044029 (3.0 MB)  TX bytes:448928 (448.9 KB)
>>           Interrupt:16
>>
>>
>> eth1      Link encap:Ethernet  HWaddr 00:02:b3:8c:dc:e7
>>           inet addr:192.168.10.1  Bcast:192.168.10.255  Mask:255.255.255.0
>>           UP BROADCAST MULTICAST  MTU:1500  Metric:1
>>           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
>>           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
>>           collisions:0 txqueuelen:1000
>>           RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
>>
>> behind the NAT, there is one machine.

Maybe this will work?

In the nat table:

-A PREROUTING -i eth0 -j DNAT --to-destination 192.168.10.1
-A POSTROUTING -o eth0 -j SNAT --to-source 89.73.128.70

You must also enable forwarding.

I don't know Ubuntu but in Redhat that's

echo 1 > /proc/sys/net/ipv4/ip_forward (temporary)

-- or --

in /etc/sysctl.conf

net.ipv4.ip_forward = 1  (permanent)

hth,
Mike Wright

      reply	other threads:[~2011-10-26 17:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAA+mFXNdGDpickA-JNukzmHhgtGM+AtZ=2dDpfvh6G-ZYdY3xA@mail.gmail.com>
2011-10-18  6:10 ` simple/ubiquitous iptables NAT config no longer works Pawel Karpowicz
2011-10-18  8:12   ` Marek Kierdelewicz
2011-10-19 16:29     ` Pawel Karpowicz
2011-10-26 17:22       ` Pawel Karpowicz
2011-10-26 17:51         ` Mike Wright [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4EA84887.7090005@mailinator.com \
    --to=mike.wright@mailinator.com \
    --cc=mafeuser@gmail.com \
    --cc=netfilter@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox