AndreasG
Active Member
hi,
ich mal wieder
hab jetzt nach diversen anleitungen:
http://www.bsdforen.de/forums/showthread.php?s=&postid=717#post717
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/dialup-firewall/index.html
meinen router konfiguriert...
- das kernel konfigurieren hat mit den bekannten options ohne probleme nun funktioniert - drum poste ich diese config mal nicht
Hier die Konfigurations-files:
rc.conf
----snip-----
defaultrouter="192.168.1.1"
gateway_enable="YES"
hostname="freebsd.home"
ifconfig_ed0="inet 192.168.1.10 netmask 255.255.255.0"
ifconfig_ep0="inet 192.168.2.10 netmask 255.255.255.0"
kern_securelevel_enable="NO"
keyrate="normal"
nfs_reserved_port_only="YES"
portmap_enable="YES"
router_enable="YES"
saver="logo"
sshd_enable="YES"
usbd_enable="YES"
scrnmap="NO"
check_quotas="NO"
apm_enable="YES"
named_enable="YES"
keymap="german.iso"
sendmail_enable="YES"
firewall_enable="YES"
firewall_type="OPEN"
firewall_script="/etc/firewall/fwrules"
firewall_logging="YES"
natd_program="/sbin/natd"
natd_enable="YES"
natd_interface="ep0"
natd_flags="-dynamic -f /etc/firewall/natd.conf"
----snap----
fwrules:
----snip----
#!/bin/sh
int_int=ed0
ext_int=ep0
ipfw -f flush
ipfw add divert natd all from any to any via $ext_int
# Allow all connections that have dynamic rules built for them,
# but deny established connections that don't have a dynamic rule.
ipfw add check-state
ipfw add deny tcp from any to any established
# Allow all localhost connections
ipfw add allow tcp from me to any out via lo0 setup keep-state
ipfw add deny tcp from me to any out via lo0
ipfw add allow ip from me to any out via lo0 keep-state
# Allow all connections from my network card that i initate
ipfw add allow tcp from me to any out xmit any setup keep-state
ipfw add deny tcp from me to any
ipfw add allow ip from me to any out xmit any keep-state
# Everyone on the Internet is allowed to connect to the following
# Services on the machine.
ipfw add allow tcp from any to me dst-port 20 in recv any setup keep-state
ipfw add allow tcp from any to me dst-port 21 in recv any setup keep-state
ipfw add allow tcp from any to me dst-port 22 in recv any setup keep-state
ipfw add allow tcp from any to me dst-port 80 in recv any setup keep-state
# Zugriffe von innen erlauben
ipfw add allow tcp from 192.168.1.0/24 to any setup keep-state
ipfw add allow udp from 192.168.1.0/24 to any setup keep-state
# Enable ICMP: remove type 8 if you don't want your host to be pingable
ipfw add allow icmp from any to any icmptypes 0,3,8,11,12,13,14
# Blockiert den port 6000 (X)
ipfw add deny log tcp from any to any 6000 in recv $ext_int
#ipfw add allow ip from any to any via lo0
#ipfw add allow ip from any to any via $int_int
# Erlaubt alle Verbindungen welche von hier initiiert wurden
ipfw add allow tcp from any to any out xmit $ext_int setup
# Wenn die Verbindung einmal hergestellt wurde, erlaube dieser offen zu stehen
ipfw add allow tcp from any to any via $ext_int established
# This sends a RESET to all ident packets.
ipfw add reset log tcp from any to any 113 in recv $ext_int
# Erlaubt ausgehende DNS queries NUR auf die beiden angegebenen Server
#ipfw add allow udp from any to 195.20.224.234 53 out xmit $ext_int
#ipfw add allow udp from any to 194.25.2.129 53 out xmit $ext_int
ipfw add allow udp from any to any 53 out xmit $ext_int
#ipfw add allow tcp from any to 195.20.224.234 53 out xmit $ext_int
#ipfw add allow tcp from any to 194.25.2.129 53 out xmit $ext_int
ipfw add allow tcp from any to any 53 out xmit $ext_int
# Erlaubt die Antwort der DNS Nachfragen
#ipfw add allow udp from 195.20.224.234 53 to any in recv $ext_int
#ipfw add allow udp from 194.25.2.129 53 to any in recv $ext_int
ipfw add allow udp from any 53 to any in recv $ext_int
#ipfw add allow tcp from 217.5.99.105 53 to any in recv $ext_int
#ipfw add allow tcp from 194.25.2.129 53 to any in recv $ext_int
ipfw add allow tcp from any 53 to any in recv $ext_int
# Alles andere verbieten
ipfw add deny ip from any to any
----snap----
(zu test-zwecken hab ich das externe interface auf ep0 gelassen da ich noch keine dsl-verbindung aufbauen kann
und das problem was ich habe:
obwohl ich in firewall_type auf OPEN gesetzt habe kann ich keinerlei zugriffe auf den rechner aber auch genausowenig von dem rechner irgendwohin machen.
bei einem einfachen ping auf localhost kommt ein fehler:
sendto: permission denied
auch wenn ich die letzte regel in der fwrules auskommentiere
# ipfw add deny ip from any to any
funktionierts nicht
ausserdem glaube ich auch nicht das die fwrules so richtig funktioniert.....
in der /var/log/messages stehen nämlich noch jedemenge der folgenden meldungen:
Mar 15 12:37:09 freebsd /kernel: ipfw: size mismatch (have 176 want 44)
Mar 15 12:37:09 freebsd /kernel: ipfw: size mismatch (have 176 want 48)
Mar 15 12:37:09 freebsd /kernel: ipfw: size mismatch (have 176 want 36)
bin im moment etwas ratlos was da schiefgegangen ist....
vielleicht hat ja einer zeit und lust sich das mal anzuschauen...
thx in advance
Andreas
ich mal wieder
hab jetzt nach diversen anleitungen:
http://www.bsdforen.de/forums/showthread.php?s=&postid=717#post717
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/dialup-firewall/index.html
meinen router konfiguriert...
- das kernel konfigurieren hat mit den bekannten options ohne probleme nun funktioniert - drum poste ich diese config mal nicht
Hier die Konfigurations-files:
rc.conf
----snip-----
defaultrouter="192.168.1.1"
gateway_enable="YES"
hostname="freebsd.home"
ifconfig_ed0="inet 192.168.1.10 netmask 255.255.255.0"
ifconfig_ep0="inet 192.168.2.10 netmask 255.255.255.0"
kern_securelevel_enable="NO"
keyrate="normal"
nfs_reserved_port_only="YES"
portmap_enable="YES"
router_enable="YES"
saver="logo"
sshd_enable="YES"
usbd_enable="YES"
scrnmap="NO"
check_quotas="NO"
apm_enable="YES"
named_enable="YES"
keymap="german.iso"
sendmail_enable="YES"
firewall_enable="YES"
firewall_type="OPEN"
firewall_script="/etc/firewall/fwrules"
firewall_logging="YES"
natd_program="/sbin/natd"
natd_enable="YES"
natd_interface="ep0"
natd_flags="-dynamic -f /etc/firewall/natd.conf"
----snap----
fwrules:
----snip----
#!/bin/sh
int_int=ed0
ext_int=ep0
ipfw -f flush
ipfw add divert natd all from any to any via $ext_int
# Allow all connections that have dynamic rules built for them,
# but deny established connections that don't have a dynamic rule.
ipfw add check-state
ipfw add deny tcp from any to any established
# Allow all localhost connections
ipfw add allow tcp from me to any out via lo0 setup keep-state
ipfw add deny tcp from me to any out via lo0
ipfw add allow ip from me to any out via lo0 keep-state
# Allow all connections from my network card that i initate
ipfw add allow tcp from me to any out xmit any setup keep-state
ipfw add deny tcp from me to any
ipfw add allow ip from me to any out xmit any keep-state
# Everyone on the Internet is allowed to connect to the following
# Services on the machine.
ipfw add allow tcp from any to me dst-port 20 in recv any setup keep-state
ipfw add allow tcp from any to me dst-port 21 in recv any setup keep-state
ipfw add allow tcp from any to me dst-port 22 in recv any setup keep-state
ipfw add allow tcp from any to me dst-port 80 in recv any setup keep-state
# Zugriffe von innen erlauben
ipfw add allow tcp from 192.168.1.0/24 to any setup keep-state
ipfw add allow udp from 192.168.1.0/24 to any setup keep-state
# Enable ICMP: remove type 8 if you don't want your host to be pingable
ipfw add allow icmp from any to any icmptypes 0,3,8,11,12,13,14
# Blockiert den port 6000 (X)
ipfw add deny log tcp from any to any 6000 in recv $ext_int
#ipfw add allow ip from any to any via lo0
#ipfw add allow ip from any to any via $int_int
# Erlaubt alle Verbindungen welche von hier initiiert wurden
ipfw add allow tcp from any to any out xmit $ext_int setup
# Wenn die Verbindung einmal hergestellt wurde, erlaube dieser offen zu stehen
ipfw add allow tcp from any to any via $ext_int established
# This sends a RESET to all ident packets.
ipfw add reset log tcp from any to any 113 in recv $ext_int
# Erlaubt ausgehende DNS queries NUR auf die beiden angegebenen Server
#ipfw add allow udp from any to 195.20.224.234 53 out xmit $ext_int
#ipfw add allow udp from any to 194.25.2.129 53 out xmit $ext_int
ipfw add allow udp from any to any 53 out xmit $ext_int
#ipfw add allow tcp from any to 195.20.224.234 53 out xmit $ext_int
#ipfw add allow tcp from any to 194.25.2.129 53 out xmit $ext_int
ipfw add allow tcp from any to any 53 out xmit $ext_int
# Erlaubt die Antwort der DNS Nachfragen
#ipfw add allow udp from 195.20.224.234 53 to any in recv $ext_int
#ipfw add allow udp from 194.25.2.129 53 to any in recv $ext_int
ipfw add allow udp from any 53 to any in recv $ext_int
#ipfw add allow tcp from 217.5.99.105 53 to any in recv $ext_int
#ipfw add allow tcp from 194.25.2.129 53 to any in recv $ext_int
ipfw add allow tcp from any 53 to any in recv $ext_int
# Alles andere verbieten
ipfw add deny ip from any to any
----snap----
(zu test-zwecken hab ich das externe interface auf ep0 gelassen da ich noch keine dsl-verbindung aufbauen kann
und das problem was ich habe:
obwohl ich in firewall_type auf OPEN gesetzt habe kann ich keinerlei zugriffe auf den rechner aber auch genausowenig von dem rechner irgendwohin machen.
bei einem einfachen ping auf localhost kommt ein fehler:
sendto: permission denied
auch wenn ich die letzte regel in der fwrules auskommentiere
# ipfw add deny ip from any to any
funktionierts nicht
ausserdem glaube ich auch nicht das die fwrules so richtig funktioniert.....
in der /var/log/messages stehen nämlich noch jedemenge der folgenden meldungen:
Mar 15 12:37:09 freebsd /kernel: ipfw: size mismatch (have 176 want 44)
Mar 15 12:37:09 freebsd /kernel: ipfw: size mismatch (have 176 want 48)
Mar 15 12:37:09 freebsd /kernel: ipfw: size mismatch (have 176 want 36)
bin im moment etwas ratlos was da schiefgegangen ist....
vielleicht hat ja einer zeit und lust sich das mal anzuschauen...
thx in advance
Andreas