Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Dec 2001 23:28:12 -0300 (ART)
From:      Vladimir Pianykh <fox@vl7.net>
To:        freebsd-security@FreeBSD.ORG
Subject:   ipfw
Message-ID:  <20011204232236.L51132-100000@VL7.net>
In-Reply-To: <4.3.2.7.2.20011204172959.04d112e0@localhost>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi!

I tried to make port forwarding to server in internal network, and nat for
users in same network. Just port forwarding is working fine, but if I
enable masquarad for internal network, I'm losing connection to redirected
servers.

What is wrong in my script?

Thank you.

out=192.168.2.1
ext_i=ep0
int_serv_1=192.168.1.1
port_1=80
int_serv_2=192.168.1.2
port_2=25

########################## forwarding ###############################

ipfw add 1000 divert 8888 tcp from any to $out $port_1 via $ext_i
ipfw add 1100 divert 8888 ip from $int_serv_1 to any via $ext_i
natd -p 8888 -n $ext_i -redirect_port tcp $int_serv_1:$port_1 $port_1

#--------------------------------------------------------------------

ipfw add 1500 divert 8889 tcp from any to $out $port_2 via $ext_i
ipfw add 1600 divert 8889 ip from $int_serv_2 to any via $ext_i
natd -p 8889 -n $ext_i -redirect_port tcp $int_serv_2:$port_2 $port_2

############################ NAT ####################################

ipfw add 0900 divert 8887 ip from any to any via $ext_i
natd -p 8887 -n $ext_i

ipfw add 65000 allow ip from any to any


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-security" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011204232236.L51132-100000>