Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Joel Newkirk <netfilter@newkirk.us>
To: ImpulseFG@netscape.net, netfilter@lists.netfilter.org
Subject: Re: Port Forwarding and opening ports.
Date: Tue, 4 Mar 2003 17:59:28 -0500	[thread overview]
Message-ID: <200303041759.28133.netfilter@newkirk.us> (raw)
In-Reply-To: <6F70EFF3.4675E661.0256A0D0@netscape.net>

[-- Attachment #1: Type: text/plain, Size: 2509 bytes --]

On Tuesday 04 March 2003 03:56 pm, ImpulseFG@netscape.net wrote:
> I have iptables setup to port forward ftp , web, and a game server to
> another server on the local network. It works great. I have also set
> it up so it only accepts incoming and outgoing connections on port 22.
> I'm having 2 problems and a couple of questions.
>
> 1. I can ssh into the machine which is 192.168.1.1 from any computer
> on the local network. But I can't run X programs without allowing all
> incoming and outgoing connections on this machine. I've tried:
> $iptables -A INPUT -i eth1 -j ACCEPT
>             $iptables -A OUTPUT -o eth1 -j ACCEPT
>
> This wouldn't fix the problem. So I tried.
>             $iptables -A INPUT -s 192.168.1.2-192.168.1.255 -j ACCEPT
>             $iptables -A OUTPUT -d 192.168.1.2-192.68.1.255 -j ACCEPT
>
> This didn't work either. Only only accepting all incomeing and
> outgoing connections would.

Try

$iptables -A INPUT -i lo -j ACCEPT
$iptables -A OUTPUT -o lo --j ACCEPT

to let the box talk to itself...

> 2. I'm having problems with the nat features.
>     I want to be able to ssh into the routing machine from of the
> local network but I can't. I have it set to accept local connections
> on port 22 for udp and tcp. But nat is nating the packets before it
> can accept them.
>     The only way I am able to get them to accept them is to disable
> nat. I tried natting all the ports around 22. See the attache script
> but for some reason that wouln't work either.
>
> Does anyone have any idea how to do this?

In your script you have lots of rules with "-j DNAT --to 
192.168.1.2-192.168.1.255" - do you really want to spread all this 
traffic out across all these addresses?  This construction will take any 
connection coming in on a matching port and send it to the first address 
in that list that doesn't currently have traffic, or the one with the 
lowest traffic.

My impression of what you want is that you want to DNAT a handful of 
specific connections to specific destinations, and then allow return 
traffic from the internet to reach the proper client, am I right?  I've 
attached your original script trimmed to the essentials and then 
commented by myself, and also attached a proposed replacement script 
that will allow the local machines to connect out, and outside 
connections only to SSH on the gateway or the three DNATs to "charlee".  
If I'm way off-base on your intentions here I apologize.

j

[-- Attachment #2: ImpulseFG.rc.firewall-2.4.mailing --]
[-- Type: application/x-shellscript, Size: 3262 bytes --]

[-- Attachment #3: ImpulseFG.revised --]
[-- Type: application/x-shellscript, Size: 1362 bytes --]

  reply	other threads:[~2003-03-04 22:59 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-04 20:56 Port Forwarding and opening ports ImpulseFG
2003-03-04 22:59 ` Joel Newkirk [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-03-05  6:47 Eugene Joubert

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=200303041759.28133.netfilter@newkirk.us \
    --to=netfilter@newkirk.us \
    --cc=ImpulseFG@netscape.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox