You are not logged in.

#1 2011-04-30 11:56:12

royce
Member
Registered: 2011-04-30
Posts: 4

how i can do with SNAT(iptables)

i have a public ip address 1.2.3.4 (assume)

and i want to setup a SNAT server to let interal PC access internet.

Archlinux (Latest Verison with newly installed  and updated)

eth0: 1.2.3.4 (public ip addr)

eth1: 192.168.0.1
mask: 255.255.255.0


---------------------------------------------------

Windows 2003

NIC1:
192.168.0.2
Gateway: 192.168.0.1
MASK:255.255.255.0


------------------------------------------------------

then i input command to Archlinux Server

iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to-source 1.2.3.4
iptables -t nat -L
i can see my rule in it

ping 8.8.8.8 (google dns) OK

but in my internal PC (windows 2003)
ping 192.168.0.1 - worked
ping 8.8.8.8 - didnot work.

-------------------------------------------
at server : i  used tcpdump -i  eth1 and  find my icmp message , but archlinux did not forward my icmp message to eth0 .

i tried lots of solutions
1. modprobe

modprobe ip_tables
modprobe ip_nat_ftp

2. iptables-save and restart iptables
3. /etc/rc.d/network restart
4. echo 1 > /proc/sys/net/ipv4/ip_forward

and them did not make SNAT work ...
What can I do?
Thx for help

Last edited by royce (2011-05-01 01:09:12)

Offline

#2 2011-04-30 17:18:58

hexanol
Member
From: Canaduh
Registered: 2009-08-04
Posts: 95

Re: how i can do with SNAT(iptables)

/proc/sys/net/ipv4/ip_forward must be set to 1, not 0.

Also, personal preference, but I prefer using sysctl, i.e. "sysctl -w net.ipv4.ip_forward=1" instead of echo + redirection.

Offline

#3 2011-05-01 01:11:18

royce
Member
Registered: 2011-04-30
Posts: 4

Re: how i can do with SNAT(iptables)

hexanol wrote:

/proc/sys/net/ipv4/ip_forward must be set to 1, not 0.

Also, personal preference, but I prefer using sysctl, i.e. "sysctl -w net.ipv4.ip_forward=1" instead of echo + redirection.

i am sorry , 0 is a typo.
i did input 1

and i use sysctl -w net.ipv4.ip_forward=1 , it still did not work

Offline

#4 2011-05-01 01:29:15

royce
Member
Registered: 2011-04-30
Posts: 4

Re: how i can do with SNAT(iptables)

hexanol wrote:

/proc/sys/net/ipv4/ip_forward must be set to 1, not 0.

Also, personal preference, but I prefer using sysctl, i.e. "sysctl -w net.ipv4.ip_forward=1" instead of echo + redirection.


hi ,thanks for ur help

i use kernel26-lts

the problem is solved.

Offline

Board footer

Powered by FluxBB