portfw on iptables 2.4 kernel problem.
I have an internel ftp server w/c i want to access over my linux router(gw) Its internel IP is 10.0.0.11 and port 21. My externel IP lets say 203.100.100.1.
I followed the docs w/c i found at linuxdoc
http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/forwarders.html
I type in this iptables rule set,
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A PREROUTING -t nat -p tcp -d $EXTIP --dport 21 -j DNAT --to 10.0.0.11:21
I enabled ip forwarding thru the kernel by typing this command, (this is the first thing i type then the iptables rule set)
echo "1" > /proc/sys/net/ipv4/ip_forward
svr:/# cat /proc/sys/net/ipv4/ip_forward 1 svr:/#
And still it does not work..
Trying 203.100.100.1...
telnet: Unable to connect to remote host: Connection refused
--
thanks,
louie miranda
Quoted 17 lines · louie miranda
I have an internel ftp server w/c i want to access over my linux router(gw) Its internel IP is 10.0.0.11 and port 21. My externel IP lets say 203.100.100.1.
I followed the docs w/c i found at linuxdoc
http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/forwarders.html
I type in this iptables rule set,iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A PREROUTING -t nat -p tcp -d $EXTIP --dport 21 -j DNAT --to 10.0.0.11:21I enabled ip forwarding thru the kernel by typing this command, (this is the first thing i type then the iptables rule set)
echo "1" >
/proc/sys/net/ipv4/ip_forward
Quoted 9 lines
svr:/# cat /proc/sys/net/ipv4/ip_forward 1 svr:/#And still it does not work..
Trying 203.100.100.1...
telnet: Unable to connect to remote host: Connection refused
Does this IP (203.100.100.1) belong to the gw?
There are also two diferent type of ftp that work in very different ways. This only accounts for the control connection. Also, you don't have forward rules for the return traffic.
Quoted 8 lines
--
thanks,
louie miranda
Signature · 19 lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
( Raymond Leach )
) Knowledge Factory (
( )
) Tel: +27 11 445 8100 (
( Fax: +27 11 445 8101 )
) (
( http://www.knowledgefactory.co.za/ )
) http://www.saptg.co.za/ (
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o o
o o
.--. .--.
| o_o| |o_o |
| \_:| |:_/ |
/ / \\ // \ \
( | |) (| | )
/`\_ _/'\ /'\_ _/`\
\___)=(___/ \___)=(___/Quoted 17 lines · louie miranda
I have an internel ftp server w/c i want to access over my linux router(gw) Its internel IP is 10.0.0.11 and port 21. My externel IP lets say 203.100.100.1.
I followed the docs w/c i found at linuxdoc
http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/forwarders.html
I type in this iptables rule set,iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A PREROUTING -t nat -p tcp -d $EXTIP --dport 21 -j DNAT --to 10.0.0.11:21I enabled ip forwarding thru the kernel by typing this command, (this is the first thing i type then the iptables rule set)
echo "1" >
/proc/sys/net/ipv4/ip_forward
Quoted 10 lines
svr:/# cat /proc/sys/net/ipv4/ip_forward 1 svr:/#And still it does not work..
Trying 203.100.100.1...
telnet: Unable to connect to remote host: Connection refused
You will have to allow port 20 aswell...FTP uses both port 20 and 21
Quoted 9 lines
--
thanks,
louie miranda
Quoted 1 line
Does this IP (203.100.100.1) belong to the gw?
Yes it does. And that's my gw.
--
louie
Quoted 1 line · louie miranda
I have an internel ftp server w/c i want to access over my linux
router(gw)
Quoted 6 lines
Its internel IP is 10.0.0.11 and port 21. My externel IP lets say 203.100.100.1.
I followed the docs w/c i found at linuxdoc
http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/forwarders.html
I type in this iptables rule set,
Quoted 6 lines
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A PREROUTING -t nat -p tcp -d $EXTIP --dport 21 -j DNAT --to 10.0.0.11:21I enabled ip forwarding thru the kernel by typing this command, (this is
the
Quoted 4 lines
first thing i type then the iptables rule set)
echo "1" >
/proc/sys/net/ipv4/ip_forward
Quoted 9 lines
svr:/# cat /proc/sys/net/ipv4/ip_forward 1 svr:/#And still it does not work..
Trying 203.100.100.1...
telnet: Unable to connect to remote host: Connection refused
Does this IP (203.100.100.1) belong to the gw?
There are also two diferent type of ftp that work in very different ways. This only accounts for the control connection. Also, you don't have forward rules for the return traffic.
Quoted 8 lines
--
thanks,
louie miranda
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
( Raymond Leach )
) Knowledge Factory (
( )
) Tel: +27 11 445 8100 (
( Fax: +27 11 445 8101 )
) (
( http://www.knowledgefactory.co.za/ )
) http://www.saptg.co.za/ (
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o o
o o
.--. .--.
| o_o| |o_o |
| \_:| |:_/ |
/ / \\ // \ \
( | |) (| | )
/`\_ _/'\ /'\_ _/`\
\___)=(___/ \___)=(___/--
thanks,
louie miranda
chikka asia, inc.
noc +63-2(7535000-511)
Engineering does not require science. Science helps a lot but people built perfectly good brick walls long before they knew why cement works.
----- Original Message -----
From: "Raymond Leach" <[email protected]>
To: "louie miranda" <[email protected]>
Cc: "Netfilter Mailing List" <[email protected]>
Sent: Tuesday, December 10, 2002 5:01 PM
Subject: Re: portfw on iptables 2.4 kernel problem.
Quoted 1 line
You will have to allow port 20 aswell...FTP uses both port 20 and 21
Hm, ic. But even when i do netstat -ln i dont see any open sockets on port 21.
--
thanks,
louie miranda
----- Original Message -----
From: "Paulo Andre" <[email protected]>
To: "louie miranda" <[email protected]>
Cc: "netfilter" <[email protected]>
Sent: Tuesday, December 10, 2002 5:01 PM
Subject: Re: portfw on iptables 2.4 kernel problem.
Quoted 2 lines · louie miranda
Quoted 1 line
I have an internel ftp server w/c i want to access over my linux
router(gw)
Quoted 6 lines
Quoted 6 lines
Its internel IP is 10.0.0.11 and port 21. My externel IP lets say 203.100.100.1.
I followed the docs w/c i found at linuxdoc
http://www.tldp.org/HOWTO/IP-Masquerade-HOWTO/forwarders.html
I type in this iptables rule set,
Quoted 6 lines
Quoted 6 lines
iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 21 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
iptables -A PREROUTING -t nat -p tcp -d $EXTIP --dport 21 -j DNAT --to 10.0.0.11:21I enabled ip forwarding thru the kernel by typing this command, (this is
the
Quoted 28 lines
Quoted 4 lines
first thing i type then the iptables rule set)
echo "1" >
/proc/sys/net/ipv4/ip_forwardQuoted 10 lines
svr:/# cat /proc/sys/net/ipv4/ip_forward 1 svr:/#And still it does not work..
Trying 203.100.100.1...
telnet: Unable to connect to remote host: Connection refusedYou will have to allow port 20 aswell...FTP uses both port 20 and 21
Quoted 9 lines
--
thanks,
louie miranda
Quoted 3 lines · louie miranda
I have an internel ftp server w/c i want to access over my linux router(gw) Its internel IP is 10.0.0.11 and port 21. My externel IP lets say 203.100.100.1.
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -A FORWARD -d 10.0.0.11 -j ACCEPT
iptables -A FORWARD -s 10.0.0.11 -j ACCEPT
iptables -A PREROUTING -t nat -p tcp -d 203.100.100.1 --dport 21 -j DNAT --to 10.0.0.11 ptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 203.100.100.1
tha should work: it's working for me, at least.
Remember that forwarded traffic must be SNATed with the source (public) address of the forwarding box. andrea
Thanks for those people who replied, But still i can't get it to work. Ill be posting my rule set here.
=======================================
panic:/# iptables -nL --line-num Chain INPUT (policy ACCEPT) num target prot opt source destination
Chain FORWARD (policy DROP)
num target prot opt source destination 1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED 2 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 3 LOG all -- 0.0.0.0/0 0.0.0.0/0 LOG flags 0
level 4
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
panic:/#
=======================================
panic:/# iptables -nL --line-num -t nat Chain PREROUTING (policy ACCEPT) num target prot opt source destination 1 REDIRECT tcp -- 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 redir ports 3128
Chain POSTROUTING (policy ACCEPT)
num target prot opt source destination
1 MASQUERADE all -- 0.0.0.0/0 0.0.0.0/0
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
panic:/#
=======================================
My rule set is just a simple masq w/ port redirection internally, catching all port 80 request
and redirect it to my squid on port 3128
I tried the simple rule set that Joel Newkirk, Andrea Rossato and all the people who have
helped me on my problem but still It does not work, I actually set all the IPTABLES/NETFILTER
options on my kernel and add "1" on /proc/sys/net/ipv4/ip_forward. I actually search and
search google.com for my similar problem and tried it all, I had no error's or such all is working
i think. It just does not connect over to my granted port. Ill try any port even port 80 or port 139
on my firewall just get this forwarding to work.
Well, thanks again. I hope what i have posted here "my rule set" will give me such nice answers
to resolved my probem, And ill cont. reading and reading any docs i can find on the internet.
--
thanks,
louie miranda