Сразу после загрузки системы (FreeBSD 8.0-RELEASE-p3) при попытке пинга внешнего ресурса имеем вот такое:
#
ipfw show00050 53 4725 allow tcp from any to me dst-port 22
00051 43 7068 allow tcp from me 22 to any
00100 0 0 allow ip from any to any via lo0
00105 690 214283 allow ip from any to any via rl0
00110 65 4896 nat 1 ip from any to any via nfe0
00120 0 0 deny ip from any to any
65535 0 0 deny ip from any to any
#
ping 217.69.128.43PING 217.69.128.43 (217.69.128.43): 56 data bytes
ping: sendto: Permission denied
ping: sendto: Permission denied
ping: sendto: Permission denied^C
--- 217.69.128.43 ping statistics ---
3 packets transmitted, 0 packets received, 100.0% packet loss
Однако после рестарта ipfw все нормализуется:
#
/etc/rc.d/ipfw restartnet.inet.ip.fw.enable: 1 -> 0
Flushed all rules.
00050 allow tcp from any to me dst-port 22
00051 allow tcp from me 22 to any
00100 allow ip from any to any via lo0
00105 allow ip from any to any via rl0
ipfw nat 1 config if nfe0 same_ports reset
00110 nat 1 ip from any to any via nfe0
00120 deny ip from any to any
Firewall rules loaded.
#
ipfw show00050 8 528 allow tcp from any to me dst-port 22
00051 5 556 allow tcp from me 22 to any
00100 0 0 allow ip from any to any via lo0
00105 240 76918 allow ip from any to any via rl0
00110 23 1316 nat 1 ip from any to any via nfe0
00120 0 0 deny ip from any to any
65535 0 0 deny ip from any to any
#
ping 217.69.128.43PING 217.69.128.43 (217.69.128.43): 56 data bytes
64 bytes from 217.69.128.43: icmp_seq=0 ttl=116 time=63.717 ms
64 bytes from 217.69.128.43: icmp_seq=1 ttl=116 time=63.448 ms
64 bytes from 217.69.128.43: icmp_seq=2 ttl=116 time=63.548 ms
64 bytes from 217.69.128.43: icmp_seq=3 ttl=116 time=63.570 ms^C
--- 217.69.128.43 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 63.448/63.571/63.717/0.096 ms
#
В чем может быть проблема? Как я понимаю, сообщение ping: sendto: Permission denied генерирует фаерволл. Но после его рестарта, как я вижу, набор правил не меняется, а тем не менее трафик уже не блокируется.
Ядро скомпилировано с опциями:
options IPFIREWALL
options IPDIVERT
options IPFIREWALL_FORWARD
options DUMMYNET
options ROUTETABLES=16
options IPFIREWALL_NAT
options LIBALIAS
File:rc.firewall
#!/bin/sh -
f='/sbin/ipfw'
ifWAN='nfe0'
ifLAN='rl0'
${f} -f flush
#${f} add 10 allow ip from any to any
${f} add 50 allow tcp from any to me 22
${f} add 51 allow tcp from me 22 to any
${f} add 100 allow ip from any to any via lo0
${f} add 105 allow ip from any to any via ${ifLAN}
${f} nat 1 config if ${ifWAN} reset same_ports
${f} add 110 nat 1 ip from any to any via ${ifWAN}
${f} add 120 deny all from any to any
File:rc.conf
mousechar_start="3"
moused_type="NO"
moused_enable="NO"
saver="blank"
font8x8="cp1251-8x8"
font8x14="cp1251-8x14"
font8x16="cp1251-8x16"
scrnmap="koi8-r2cp866"
keyrate="fast"
keymap="ru.koi8-r"
hostname="mtc.test.local"
gateway_enable="YES"
ifconfig_nfe0="DHCP"
ifconfig_rl0="inet 192.168.47.1 netmask 255.255.255.0"
sshd_enable="YES"
firewall_enable="YES"
ntpd_enable="YES"
inetd_enable="NO"
#named_enable="YES"
fsck_y_enable="YES"
background_fsck="NO"