Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Julian Labuschagne <personxx@wan4u.co.za>
To: netfilter@lists.netfilter.org
Subject: Re: Port Forwarding Problem
Date: Fri, 15 Apr 2005 11:23:31 +0000	[thread overview]
Message-ID: <425FA433.9040106@wan4u.co.za> (raw)
In-Reply-To: <20050415084039.7032.qmail@arcoscom.com>

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

Samuel Díaz García wrote:

> Without having a look into your scripts, I think you need:
> 1) Allow INPUT into filter table to the port.
> 2) Allow FORDWARD into filter table to the redirected conection.
> Good luck.
>
Line 56: $IPTABLES -A INPUT -i $INET_IFACE -p tcp --dport 800 -j ACCEPT
Line 57: $IPTABLES -A INPUT -i $INET_IFACE -p udp --dport 800 -j ACCEPT
Line 58:
Line 59: # Forward Chain
Line 60: $IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
Line 61: $IPTABLES -A FORWARD -o $LAN_IFACE -j ACCEPT

Line 85: $IPTABLES -A PREROUTING -t nat -p tcp -d $INET_IP --dport 800 
-j DNAT --to 192.168.1.5:800
Line 86: $IPTABLES -A PREROUTING -t nat -p udp -d $INET_IP --dport 800 
-j DNAT --to 192.168.1.5:800

This is a few lines from the attached firewall.
I think you may be reffering to these lines of the firewall script.

On Lines 56,57 I allow connections to my gateway on port 800
On Lines 60,61 I allow all connections in the forwarding chain.
And on Lines 85,86 is the port forwarding rules.

Kind Regards Julian.







[-- Attachment #2: custom.firewall --]
[-- Type: text/plain, Size: 2297 bytes --]

#!/bin/bash

# Set path to iptables binary
IPTABLES=/usr/sbin/iptables

#
# Loopback IP and Interface
#
LO_IFACE="lo"
LO_IP="127.0.0.1"

#
# Internet IP and Interface
#
INET_IP=`/sbin/ifconfig ppp0 | grep "inet addr" | cut -d: -f2 | cut -d ' ' -f1`
INET_IFACE="ppp0"

#
# LAN Range, IP Address and Interface
#
LAN_IP="192.168.1.1"
LAN_IP_RANGE="192.168.1.0/24"
LAN_BCAST_ADRESS="192.168.1.255"
LAN_IFACE="eth0"

# 
# Set default policies
#
$IPTABLES -P INPUT DROP
$IPTABLES -P OUTPUT DROP
$IPTABLES -P FORWARD DROP

#
# Flush Chains
#
$IPTABLES -F
$IPTABLES -t nat -F

#
# Allow loopback interface
#
$IPTABLES -A INPUT -i $LO_IFACE -j ACCEPT
$IPTABLES -A OUTPUT -o $LO_IFACE -j ACCEPT

# Output Chain
$IPTABLES -A OUTPUT -o $INET_IFACE -p tcp --dport 53 -j ACCEPT
$IPTABLES -A OUTPUT -o $INET_IFACE -p udp --dport 53 -j ACCEPT
$IPTABLES -A OUTPUT -o $INET_IFACE -p tcp --dport 25 -j ACCEPT
$IPTABLES -A OUTPUT -o $INET_IFACE -p tcp --dport 80 -j ACCEPT
$IPTABLES -A OUTPUT -o $INET_IFACE -p tcp --dport 110 -j ACCEPT

# Input Chain
$IPTABLES -A INPUT -i $INET_IFACE -p tcp -m state --state established,related -j ACCEPT
$IPTABLES -A INPUT -i $INET_IFACE -p udp -m state --state established,related -j ACCEPT

$IPTABLES -A INPUT -i $INET_IFACE -p tcp --dport 800 -j ACCEPT
$IPTABLES -A INPUT -i $INET_IFACE -p udp --dport 800 -j ACCEPT

# Forward Chain
$IPTABLES -A FORWARD -i $LAN_IFACE -j ACCEPT
$IPTABLES -A FORWARD -o $LAN_IFACE -j ACCEPT

#
# Allow ICMP
#
$IPTABLES -A OUTPUT -o $INET_IFACE -p icmp -j ACCEPT
$IPTABLES -A INPUT -i $INET_IFACE -p icmp -j ACCEPT

#
# Users allowed internet access
#
$IPTABLES -A INPUT -i $LAN_IFACE -s 192.168.1.143 -j ACCEPT
$IPTABLES -A OUTPUT -o $LAN_IFACE -d 192.168.1.143 -j ACCEPT

$IPTABLES -A INPUT -i $LAN_IFACE -s 192.168.1.5 -j ACCEPT
$IPTABLES -A OUTPUT -o $LAN_IFACE -d 192.168.1.5 -j ACCEPT

$IPTABLES -A INPUT -i $LAN_IFACE -s 192.168.1.8 -j ACCEPT
$IPTABLES -A OUTPUT -o $LAN_IFACE -d 192.168.1.8 -j ACCEPT


#
# Add port forwarding rule
#
$IPTABLES -A PREROUTING -t nat -p tcp -d $INET_IP --dport 800 -j DNAT --to 192.168.1.5:800
$IPTABLES -A PREROUTING -t nat -p udp -d $INET_IP --dport 800 -j DNAT --to 192.168.1.5:800

#
# Masquerade LAN users (Internet Sharing)
#
$IPTABLES -t nat -A POSTROUTING -o $INET_IFACE -j SNAT --to-source $INET_IP

  reply	other threads:[~2005-04-15 11:23 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-04-15 10:34 Port Forwarding Problem Julian Labuschagne
2005-04-15  8:40 ` Samuel Díaz García
2005-04-15 11:23   ` Julian Labuschagne [this message]
2005-04-15 14:32   ` Taylor, Grant
2005-04-15 14:40   ` Jason Opperisano
  -- strict thread matches above, loose matches on Subject: below --
2010-10-16 12:53 Port forwarding problem Carlos Mtz-Troncoso
2010-10-16 13:13 ` Pascal Hambourg
2010-10-16 13:19   ` Carlos Mtz-Troncoso
2010-10-16 13:37     ` Pascal Hambourg
2010-10-16 14:01       ` Carlos Mtz-Troncoso
2010-10-16 18:19         ` Pascal Hambourg
2008-04-24 19:17 Port Forwarding Problem Ivan Hernandez
2008-04-25 19:49 ` Grant Taylor
2005-07-18  5:17 George Esperanza
2005-04-15 10:36 Julian Labuschagne
2003-02-25 18:06 Tom Smith
2003-02-25 20:14 ` Willi Dyck
2003-02-25 21:53   ` Tom Smith
2003-02-26  3:20 ` Arnt Karlsen
     [not found]   ` <3E5C3DEE.70104@openadventures.org>
2003-02-26 14:07     ` Arnt Karlsen
     [not found] <001601c2d1fa$669894e0$990da8c0@..153.service>
2003-02-11 19:11 ` Port forwarding problem DarKRaveR
2003-02-11 19:14 ` Rob Sterenborg
2003-02-11 18:21 Danila Octavian
2003-01-29  0:56 port " Ian McBeth
2003-01-28  8:14 oarojo
2003-01-29  1:21 ` Arnt Karlsen
2002-11-14  4:29 Port " Tom Elsesser
2002-11-24 20:40 ` Joel Newkirk

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=425FA433.9040106@wan4u.co.za \
    --to=personxx@wan4u.co.za \
    --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