From: Jim Laurino <nfcan.x.jimlaur@dfgh.net>
To: netfilter@lists.netfilter.org
Subject: Re: Port forwarding not working (nfcan: to exclusive)
Date: Sun, 29 Apr 2007 00:04:16 -0400 [thread overview]
Message-ID: <1177819456l.3596l.0l@soapy> (raw)
In-Reply-To: <000001c78a0c$a7b02cd0$dededede@neilhp> (from +nfcan+jimlaur+ce6b708e36.neil#JAMMConsulting.com@spamgourmet.com on Sat Apr 28 23:15:33 2007)
On 04/28/2007 11:15:33 PM, Neil Aggarwal - neil@JAMMConsulting.com wrote:
> Hello:
>
> I have a Linux box acting as a firewall and gateway
> for my local internet. The private IP is 192.168.1.1
>
> Behind that, I have a Linksys VPN box. Its IP
> is 192.168.1.101.
>
> If I go to my Linux box and issue this command:
>
> telnet 192.168.1.101 1723
>
> I get this output:
>
> Trying 192.168.1.101...
> Connected to 192.168.1.101 (192.168.1.101).
> Escape character is '^]'.
>
> Everything is fine. I can connect to the Linksys box
> without a problem.
>
> Now, I want to set up routing from the external world
> to be able to access the Linksys box.
>
> I added this rule to my firewall to do the forwarding:
>
> /sbin/iptables -t nat -A PREROUTING -p tcp -i eth0 -d $ETH0_IP
> --sport 1024: --dport 1723
> -j DNAT --to $LINKSYS_VPN_IP:1723
>
> It is all one one line, I added link breaks for readability.
>
OK, you have forwarded this port from the firewall to the vpn box.
Now you have to accept it.
(You must have a default drop policy in forward.)
> When I tried to telnet to port 1723 on my public IP, I saw logs
> from my firewall for inbound packets so I added these rules:
>
> /sbin/iptables -A FORWARD -i eth0 -o eth1 -d $LINKSYS_VPN_IP
> -p tcp --sport 1024: --dport 1723
> -m state --state NEW,ESTABLISHED -j ACCEPT
> /sbin/iptables -t nat -A POSTROUTING -o eth1 -d $LINKSYS_VPN_IP
> -p tcp --sport 1024: --dport 1723
> -m state --state NEW,ESTABLISHED -j ACCEPT
>
You need packets to flow in both directions.
The outside should be able to initiate
so the first rule looks good:
/sbin/iptables -A FORWARD -i eth0 -o eth1 -d $LINKSYS_VPN_IP
-p tcp --sport 1024: --dport 1723
-m state --state NEW,ESTABLISHED -j ACCEPT
But you need to accept the return packets.
How about this for the return pattern:
/sbin/iptables -A FORWARD -i eth1 -o eth0 -s $LINKSYS_VPN_IP
-p tcp --sport 1723
-m state --state ESTABLISHED -j ACCEPT
The accept in the nat postrouting can be removed.
HTH
--
Jim Laurino
nfcan.x.jimlaur@dfgh.net
Please reply to the list.
Only mail from the listserver reaches this address.
next prev parent reply other threads:[~2007-04-29 4:04 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-29 3:15 Port forwarding not working Neil Aggarwal
2007-04-29 4:04 ` Jim Laurino [this message]
2007-04-29 4:56 ` Port forwarding not working (nfcan: to exclusive) neil
2007-04-29 7:10 ` Port forwarding not working (nfcan: to exclusive) " Jim Laurino
2007-04-29 13:06 ` Neil Aggarwal
2007-04-29 13:29 ` Jan Engelhardt
2007-04-29 14:39 ` Port forwarding not working Jim Laurino
2007-04-30 2:11 ` Neil Aggarwal
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=1177819456l.3596l.0l@soapy \
--to=nfcan.x.jimlaur@dfgh.net \
--cc=netfilter@lists.netfilter.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.