Sponsored Content
Operating Systems Linux Debian Iptables Nat forward port 29070 Post 302598297 by titoms on Tuesday 14th of February 2012 03:44:13 AM
Old 02-14-2012
Iptables Nat forward port 29070

Hello, the Nat and the forward worked on my debian server up to the reboot of machines.

The following rules*:


/sbin/iptables -t nat -A PREROUTING -p tcp -i eth2 -d xxx.xxx.xxx.xxx --dport 29070 -j DNAT --to-destination 10.0.1.7:29070
/sbin/iptables -A FORWARD -p tcp -i eth2 -o eth0 -d 10.0.1.7 --dport 29070 --sport 1024:65535 -m state --state NEW -j ACCEPT

Since the reboot, that doesn't work any more.

I have another rules towards one the others server and that her works.


/sbin/iptables -t nat -A PREROUTING -p tcp -i eth2 -d xxx.xxx.xxx.xxx --dport 29082 -j DNAT --to-destination 10.0.1.8:29082
/sbin/iptables -A FORWARD -p tcp -i eth2 -o eth0 -d 10.0.1.8 --dport 29082 --sport 1024:65535 -m state --state NEW -j ACCEPT


Thank you for your help .
 

10 More Discussions You Might Find Interesting

1. IP Networking

NAT Packets/Port Openine

Firstly, I have no knowledge of hubs, so please keep any advice simple! I have a UNIX hub, connecting three PCs and would like to know if the hub has NAT translation for incoming packets and if th hub is able to NAT translate packets coming in to a local (internal) LAN address.. (3 Replies)
Discussion started by: MartinD
3 Replies

2. UNIX for Advanced & Expert Users

ssh port forward over three server

Hello there, I have a big problem, and I hope somebody can help me. I try to realize a port forward over three server. Here is a picture... Client Server1 | Server2 ------- ------- | ------- |...... | |...... | | |...... ... (2 Replies)
Discussion started by: Art007
2 Replies

3. IP Networking

port forward & DYNDNS Inquiry

Hi, Is there anyone know how to make port forward? And also, how to set up DYNDNS with router? (1 Reply)
Discussion started by: eel
1 Replies

4. IP Networking

iptables forward public IP, no NAT, Debian i386

Hello all, got kinda problem. Have two machines in LAN, one of them connected to Internet directly, another one must be forwarded through the first one. Masquerading works perfectly, but is not what is needed here. Both machines have public IP addresses, when the second machine is forwarded its... (0 Replies)
Discussion started by: Action
0 Replies

5. Ubuntu

Iptables forward traffic to forward chain!!!

Hi, I am new to linux stuff. I want to use linux iptables to configure rule so that all my incoming traffic with protocol "tcp" is forwarded to the "FORWARD CHAIN". The traffic i am dealing with has destination addresss of my machine but i want to block it from coming to input chain and somehow... (0 Replies)
Discussion started by: arsipk
0 Replies

6. UNIX for Advanced & Expert Users

ipf/ipnat NAT/port forward issues

I've been going crazy trying to get this working. Here's the situation: we have a Solaris 10 box that connects an internal network to an external network. We're using ipf/ipnat on it. We've added a couple of new boxes to the internal network (192.168.1.100, .101) and want to be able to get to port... (1 Reply)
Discussion started by: spakov
1 Replies

7. Red Hat

NAT Loopback and iptables

Hello, please can you help and explain me. I have two servers. Both are RHEL6. I use the first one like router and the second one for apache. Router forwards 80 port on the second server and I can open that from the internet (mysite.com, for example). But I can not open mysite.com if i try to... (0 Replies)
Discussion started by: 6765656755
0 Replies

8. Cybersecurity

iptables in a NAT scenario

Hi, I am learning IPTables have this question. My server is behind a firewall that does a PAT & NAT to the LAN address. Internet IP: 68.1.1.23 Port: 10022 Server LAN IP: 10.1.1.23 port: 22 Allowed Internet IPs: 131.1.1.23, 132.1.1.23 I want to allow a set of IPs are to be able to... (1 Reply)
Discussion started by: capri_guy84
1 Replies

9. Cybersecurity

Openvpn nat and iptables

good day good people hi first to tell that firewall and vpn is working as expected, but I notice something strange. I have host system 11.11.11.11(local ip) firewall is blocking everything except port to vpn. I have vpn on virtualized system 22.22.22.22 (CentOS both host and virtual). ... (0 Replies)
Discussion started by: end
0 Replies

10. Red Hat

Port Forward to VPN client.

Hi all, I can't port forward from WAN to VPN Client. VPN Client Ubuntu 18 192.168.0.16 Port 6000 VPN Gateway for LAN clients Centos 192.168.0.12 Router 192.168.0.1 I can forward to the VPN Client if VPN is not connected if I forward Port 6000 from 192.168.0.1 directly to 192.168.0.16.... (2 Replies)
Discussion started by: stinkefisch
2 Replies
uruk-rc(5)							   FILE FORMATS 							uruk-rc(5)

  NAME
      uruk-rc - uruk resource file, defining access policy

  SYNOPSIS
      /etc/uruk/rc

  DESCRIPTION
      rc is a shell script snippet, sourced in uruk by /bin/sh.

      rc lists IP addresses, allowed to use services.

  EXAMPLES
      The  simplest  valid rc file is the empty file. This rc file blocks all TCP and UDP connection attempts to services on our host: this is the
      default behaviour.  The simplest rc file which does allow traffic to our services looks like e.g.:

      interfaces=eth0

      ip_eth0=192.168.26.27
      net_eth0=192.168.0.0/16

      services_eth0_tcp=local
      ports_eth0_tcp_local="0:65535"
      sources_eth0_tcp_local="0.0.0.0/0"

      services_eth0_udp=local
      ports_eth0_udp_local="0:65535"
      sources_eth0_udp_local="0.0.0.0/0"

      This rc file allows all IPv4 UDP and TCP traffic from publicly routable IPs to eth0's IP.  For a more reasonable rc file, look at the  well-
      commented example rc file in /usr/share/doc/uruk/examples/rc.

  HOOKS
      Uruk offers hooks for inserting your own code between iptables invocations.  Examples will show the usefulness of these hooks.

      allowing broadcasts
      In rc, there is:

       rc_b=$etcdir/bootp

      while the file bootp reads

       iptables -A INPUT -m state --state NEW -i eth0 
	 --protocol udp --destination-port bootps -j ACCEPT

      .   This	enables  one  to add rules for packets with broadcast addresses in their destination. (Uruk has no support for this in its regular
      rc.)

      allowing non-matching returntraffic
      In rc there is:

       rc_d=$etcdir/dns

      while the file dns reads

	for source in 10.5.0.27 10.56.0.40
	do
	  $iptables -A INPUT -i eth0 --protocol udp 
	    --source "$source" --source-port domain 
	    --destination "$ip_eth0" 
	    --destination-port 30000: -j ACCEPT
	done

      This allows one to allow (return)traffic, disregarding the state. (Uruk has no support for this in its regular rc.)

      allowing NAT
      In rc there is:

       rc_a=${etcdir}/nat

      while the file nat reads

	$iptables -t nat -A POSTROUTING 
	  --out-interface eth0 -j SNAT 
	  --to-source $ip_eth0

      This allows Network Address Translation. However, beware! Like all extensive use of hooks, this will break the uruk-save script. If you make
      sure  your active iptables rules are wiped, and invoke uruk manually to load new rules, you're safe. Using the init-script with it's default
      settings is safe too.

      allowing any traffic on an interface
      In rc there is:

       interfaces_unprotect="lo eth2"

      This allows any traffic on eth2 (and on lo, the default), including any ICMP packets and packets from any source address.

      using multiple hooks at one entry point in the main uruk process
      In case rc_a, rc_b, ... , or rc_i does not have a file as its value, but a directory, all files matching "$rc_x"/*.rc will get sourced. This
      helps configuration management in complex situations involving lots of uruk configuration files for lots of hosts.

      See the section "THE GORY DETAILS: uruk INTERNALS" in uruk(8) (or the uruk source) to find out which hook (there are hooks rc_a, rc_b, ... ,
      rc_i) to use.

  NETWORK INTERFACES WITH MULTIPLE IP ADDRESSES
      Uruk supports situations where a network interface has more than one IP address attached. Variables ips_nic  and	bcasts_nic  are  used  for
      this.

      If ips_nic is set, e.g. like

       ips_eth0="ip0 ip1 ip2"

      we assume multiple (three in this example) IPs are assigned to eth0. If this variable is not set only one IP is supported on eth0.

      In multiple-IP mode, IP addresses are listed as e.g.

       ip_eth0_ip0="137.56.247.16"

      (If  you're used to the Linux ifconfig(8) output, you could use the name ip1 for eth0:1, and ip0 for eth0.)  The ports, services and sources
      variables look like e.g.

       services_eth0_ip2_tcp=local
       ports_eth0_ip2_tcp_local=smtp
       sources_eth0_ip2_tcp_local=$localnet

      and, similarly,

       net_eth0_ip1=192.168.0.0/16

      Furthermore, for dropping broadcast packets, specify e.g.

       bcasts_eth0="ip0 ip2"	 # yes, possibly a subset of ips_eth0
       bcast_eth0_ip0="10.0.0.255"
       bcast_eth0_ip2="10.0.255.255"

      The interfaces_nocast variable holds things like eth0 and eth1, like in single-IP-per-nic mode.

  LOGGING AND DEBUGGING
      Uruk has support for logging network packets, and for debugging the uruk script.

      Logging
      By default, uruk logs denied packets. This is adjustable using the loglevel variable. The settings are:

      o
	"zero": be silent; do not log any packet. rc file features loglevel=10.
      o
	"low": log denied packets, which are targetted at one of our IPs.  rc file features loglevel=30.
      o
	"medium": log denied non-broadcast packets. This is the default: loglevel is unset or rc file features loglevel=50.
      o
	"fascist": log all packets. rc file features loglevel=90.

      Debugging
      To debug the uruk script, invoke uruk as

       sh -x /usr/sbin/uruk

      this shows what is done, along with executing it. (Like an uruk '-v' option.)  (Alternatively, add "set -x" to your rc file.)

      If you'd rather prefer not to execute, but just watch what would've been done, invoke uruk as

       URUK_IPTABLES='echo iptables' URUK_IP6TABLES='echo ip6tables' uruk

      (Like an uruk '-n' option.) If you have this statement set, you can run uruk under a non-priviliged user account.

      If you'd like to test a new rc file before installing it, run something like:

	URUK_CONFIG=/path/to/new/uruk/rc/file uruk

      Of course, all these tweaks can be combined.

  VARIABLES
      The uruk script honors the following variables in rc files:

      o
	"version" Uruk version compatibility of this rc file
      o
	"loglevel"
      o
	"iptables" Full pathname of iptables executable.
      o
	"ip6tables" Full pathname of ip6tables executable.
      o
	"interfaces" List of network interfaces.
      More variables are available. For now, you'll have to take a look at  the  example  rc  file  in	/usr/share/doc/uruk/examples/rc  for  more
      details.

  ENVIRONMENT VARIABLES
      See uruk(8) for a list of honored environment variables.

  FILES
      /etc/uruk/rc

  SEE ALSO
      A well-commented example rc file is in /usr/share/doc/uruk/examples/rc.  And see uruk(8), uruk-save(8).

  COPYRIGHT
      Copyright  (C)  2003 Stichting LogReport Foundation logreport@logreport.org; Copyright (C) 2003, 2004 Tilburg University http://www.uvt.nl/;
      Copyright (C) 2003, 2004, 2005, 2010 Joost van Baal <joostvb-uruk@mdcc.cx>

      This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License  as  published	by
      the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

      This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABIL-
      ITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

      You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

  AUTHOR
      Joost van Baal <joostvb-uruk@mdcc.cx>

  uruk-rc 20120530						      30 mai 2012							  uruk-rc(5)
All times are GMT -4. The time now is 01:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy