Re: simple/ubiquitous iptables NAT config no longer works

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
--
To unsubscribe from this list: send the line "unsubscribe netfilter" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Netfilter Development]     [Linux Kernel Networking Development]     [Netem]     [Berkeley Packet Filter]     [Linux Kernel Development]     [Advanced Routing & Traffice Control]     [Bugtraq]

  Powered by Linux