From: <iptables@kilsgaard.dk>
To: netfilter@lists.samba.org
Subject: NAT, ports and iptables
Date: Sun, 2 Jun 2002 03:53:34 +0200 [thread overview]
Message-ID: <000101c209d8$5183e720$6401a8c0@GKXP> (raw)
I am quite new to LINUX and Iptables, i have worked some with FreeBSD
and ipfw, but now i am werry confused by the way iptable handles the
roules.
I hope that some of you can help me.
I have made the script listed below, from pieces found on the internet,
and it also works fine, with NAT and no ports are open out to the
internet.
But can anyone tell men how i can open for ports, so they can bee
accessed from the internet.
I would like joust to open some ports (80,21,22.).
And then i would linke to translate a port to an local Ip
address, so i can access a PC on my local LAN from the internet.
Is the rules i have made okay, or is there an better way to doo the
trick.
Is there a place where there is a description of iptables and its
posibilities?
Thanks (and sorry for by bad english)
/Graves Kilsgaard
Here is my script:
--------------------------------------------------------------------
#!/bin/bash
# Variables
FWCMD="/sbin/iptables"
FWSAVE="/sbin/iptables"
OUTIP="***.***.***.***"
OUTEth='eth1'
#Flush all rules
$FWCMD -t nat -F
$FWCMD -F
$FWCMD -X block
#Stopping service
/etc/rc.d/init.d/iptables stop
#Enable nat
$FWCMD -t nat -A POSTROUTING -o $OUTEth -j SNAT --to-source $OUTIP
#Setting rules
$FWCMD -N block
$FWCMD -A INPUT -j block
$FWCMD -A FORWARD -j block
$FWCMD -A block -m state --state RELATED,ESTABLISHED -j ACCEPT
$FWCMD -A block -i ! eth1 -m state --state NEW -j ACCEPT
$FWCMD -A block -j DROP
#Saving rules
/etc/rc.d/init.d/iptables save
#Starting service
/etc/rc.d/init.d/iptables start
--------------------------------------------------------------------
next reply other threads:[~2002-06-02 1:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-02 1:53 iptables [this message]
2002-06-02 8:21 ` NAT, ports and iptables Antony Stone
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='000101c209d8$5183e720$6401a8c0@GKXP' \
--to=iptables@kilsgaard.dk \
--cc=netfilter@lists.samba.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.