Port forwarding on OpenBSD
May 29, 2006 1 Comment
I’ve never used OpenBSD, but I’ve heard that the BSD-flavours are great for routing (using a physical box).
Since the support subforum is purged after two weeks, I thought a nice “guide” to do port forwarding on a OpenBSD box was in place.
Disclaimer: I have no tried this but considering ‘Slycer’ did it (and assuming he/she didn’t leave anything out), I have no reason to doubt.
(The code is a copy-paste from Slycer’s configure file.)
# cat /etc/pf.conf
# $OpenBSD: pf.conf,v 1.31 2006/01/30 12:20:31 camield Exp $
#
# See pf.conf(5) and /usr/share/pf for syntax and examples.
# Remember to set net.inet.ip.forwarding=1 and/or net.inet6.ip6.forwarding=1
# in /etc/sysctl.conf if packets are to be forwarded between interfaces.# — MACRO section
# — Change ext_ip to your external IP (www.whatismyip.com eg)
ext_if = rl0
int_if = rl1
ext_ip = “111.111.111.111”# — Write here the internal IP the box you want to forward the port to
Dc = “192.168.0.1”# — Write here which ports you wish to forward
DcUDP = “1111”
DcTCP = “2222”# — OPTIONS section
set skip on lo0
set skip on $int_if# — TRANSLATION (NAT/RDR) section
nat pass on $ext_if inet from any -> $ext_ifrdr pass on $ext_if proto { tcp, udp } from any to any port { $DcTCP, $DcUDP } -> { $Dc }
# — FILTER section
# — default policy
block log all# — EXTERNAL INTERFACE RULES
pass out quick on $ext_if inet all keep state
You should then input your external IP in DC++ and then input the DcUDP/DcTCP ports in DC++.