Hallo FreeBSD Gemeinde,
da ich nun schon seit Stunden dran sitz und noch keinen Millimeter weiter bin, brauche ich nun doch eure Hilfe.
Folgende Konfiguration:
Strato FreeBSD Server (6.2) mit einer externen IP.
Jail:
IP: 192.168.0.1 mit SSH (Port 2222)
Die Jail läuft soweit auch und ich kann mich vom Server auf die Jail per ssh 192.168.0.1 -p2222 ohne Probleme verbinden.
Mein Problem ist nun, wie ich eine Anfrage von meiner externen IP z.B. auf Port 2222 an die Jail (Port 2222) weiterleite.
Hier meine Konfigurationsdateien:
Host:
/etc/rc.conf
/etc/firewall/fwrules
/etc/firewall/natd.conf
EDIT:
Jail Konfiguration:
Hab auch schon versucht in der Jail per tcpdump zu schaun, ob Pakete angekommen, aber nichts hat funktioniert
Hat jemand von euch einen Tipp, wie ich diese Konfiguration zum Laufen bringen könnte?
Gruß Markus
da ich nun schon seit Stunden dran sitz und noch keinen Millimeter weiter bin, brauche ich nun doch eure Hilfe.
Folgende Konfiguration:
Strato FreeBSD Server (6.2) mit einer externen IP.
Jail:
IP: 192.168.0.1 mit SSH (Port 2222)
Die Jail läuft soweit auch und ich kann mich vom Server auf die Jail per ssh 192.168.0.1 -p2222 ohne Probleme verbinden.
Mein Problem ist nun, wie ich eine Anfrage von meiner externen IP z.B. auf Port 2222 an die Jail (Port 2222) weiterleite.
Hier meine Konfigurationsdateien:
Host:
/etc/rc.conf
Code:
ifconfig_fxp0="inet 85.214.57.XX netmask 255.255.0.0"
ifconfig_fxp0_alias0="inet 192.168.0.1 netmask 255.255.0.0"
firewall_enable="YES"
firewall_script="/etc/firewall/fwrules"
firewall_logging="YES"
natd_program="/sbin/natd"
natd_enable="YES"
natd_interface="fxp0"
natd_flags="-dynamic -f /etc/firewall/natd.conf"
jail_enable="YES"
jail_list="www"
jail_www_rootdir="/jail/www"
jail_www_hostname="www.mein-hostname.de"
jail_www_ip="192.168.0.1"
jail_www_exec="/bin/sh /etc/rc"
jail_www_devfs_enable="YES"
jail_www_devfs_ruleset="devfsrules_jail"
/etc/firewall/fwrules
Code:
#!/bin/sh
fwcmd="/sbin/ipfw"
${fwcmd} -f flush
open_ports="2222,22"
setup_loopback () {
############
# Only in rare cases do you want to change these rules
#
${fwcmd} add 100 pass all from any to any via lo0
${fwcmd} add 200 deny all from any to 127.0.0.0/8
${fwcmd} add 300 deny ip from 127.0.0.0/8 to any
}
# set these to your outside interface network and netmask and ip
oif="fxp0"
onet="85.214.57.0"
omask="255.255.0.0"
oip="85.214.57.XX"
setup_loopback
# natd
${fwcmd} add 10 divert natd all from any to any via fxp1
# Stop RFC1918 nets on the outside interface
${fwcmd} add deny all from any to 10.0.0.0/8 via ${oif}
${fwcmd} add deny all from any to 172.16.0.0/12 via ${oif}
${fwcmd} add deny all from any to 192.168.0.0/16 via ${oif}
# Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
# DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
# on the outside interface
${fwcmd} add deny all from any to 0.0.0.0/8 via ${oif}
${fwcmd} add deny all from any to 169.254.0.0/16 via ${oif}
${fwcmd} add deny all from any to 192.0.2.0/24 via ${oif}
${fwcmd} add deny all from any to 224.0.0.0/4 via ${oif}
${fwcmd} add deny all from any to 240.0.0.0/4 via ${oif}
# Stop RFC1918 nets on the outside interface
${fwcmd} add deny all from 10.0.0.0/8 to any via ${oif}
${fwcmd} add deny all from 172.16.0.0/12 to any via ${oif}
${fwcmd} add deny all from 192.168.0.0/16 to any via ${oif}
# Stop draft-manning-dsua-03.txt (1 May 2000) nets (includes RESERVED-1,
# DHCP auto-configuration, NET-TEST, MULTICAST (class D), and class E)
# on the outside interface
${fwcmd} add deny all from 0.0.0.0/8 to any via ${oif}
${fwcmd} add deny all from 169.254.0.0/16 to any via ${oif}
${fwcmd} add deny all from 192.0.2.0/24 to any via ${oif}
${fwcmd} add deny all from 224.0.0.0/4 to any via ${oif}
${fwcmd} add deny all from 240.0.0.0/4 to any via ${oif}
# Allow TCP through if setup succeeded
${fwcmd} add pass tcp from any to any established
# Allow IP fragments to pass through
${fwcmd} add pass all from any to any frag
# Allow access to our DNS
${fwcmd} add pass tcp from any to ${oip} 53 setup
${fwcmd} add pass udp from any to ${oip} 53
${fwcmd} add pass udp from ${oip} 53 to any
# Allow access to our open_ports
${fwcmd} add pass tcp from any to ${oip} ${open_ports} setup
# Reject&Log all setup of incoming connections from the outside
${fwcmd} add deny log tcp from any to any in via ${oif} setup
# Allow setup of any other TCP connection
${fwcmd} add pass tcp from any to any setup
# Allow DNS queries out in the world
${fwcmd} add pass udp from ${oip} to any 53 keep-state
# Allow NTP queries out in the world
${fwcmd} add pass udp from ${oip} to any 123 keep-state
/etc/firewall/natd.conf
Code:
redirect_port tcp 192.168.0.1:2222 2222
redirect_port udp 192.168.0.1:2222 2222
EDIT:
Jail Konfiguration:
Code:
rpcbind_enable="NO"
network_interface=""
hostname="www.noteip.info"
sendmail_enable="NONE"
sshd_enable="YES"
sshd_flags="-p 2222"
Hab auch schon versucht in der Jail per tcpdump zu schaun, ob Pakete angekommen, aber nichts hat funktioniert
Hat jemand von euch einen Tipp, wie ich diese Konfiguration zum Laufen bringen könnte?
Gruß Markus
Zuletzt bearbeitet: