web-dev-qa-db-ja.com

NFSを使用したFreeBSDpf

pfがオンになっていると、新しいNFS接続を確立できません。

サーバーとクライアントでpfをオフにすると、問題なくマウントできます。

サーバー構成でkeep stateflags S/SAを試しましたが、同じ結果が得られました。フラグを間違って設定していますか?

クライアントpf.conf

pass in on $int_if inet proto { tcp udp } from $nfs_int_ip to ($int_if) port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }
pass out on $int_if inet proto { tcp udp } from ($int_if) to $nfs_int_ip port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }

サーバーpf.conf

pass in on $int_if inet proto { tcp udp } from $int_subnet to ($int_if) port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }
pass out on $int_if inet proto { tcp udp } from ($int_if) to $int_subnet port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }

以下は、クライアントにマウントしようとしたときのサーバーからのSudo tcpdump -tttnnnvvv -i pflog0の出力です。

00:00:27.567834 IP (tos 0x0, ttl 64, id 13093, offset 0, flags [none], proto UDP (17), length 84)
    10.132.42.85.817 > 10.132.42.148.111: [udp sum ok] UDP, length 56
00:00:00.009245 IP (tos 0x0, ttl 64, id 54776, offset 0, flags [none], proto UDP (17), length 56)
    10.132.42.148.111 > 10.132.42.85.817: [udp sum ok] UDP, length 28
00:00:00.003862 IP (tos 0x0, ttl 64, id 13094, offset 0, flags [DF], proto TCP (6), length 60)
    10.132.42.85.871 > 10.132.42.148.2049: Flags [S], cksum 0x97b8 (correct), seq 1435157682, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 1292227501 ecr 0], length 0
00:00:00.000283 IP (tos 0x0, ttl 64, id 54777, offset 0, flags [DF], proto TCP (6), length 60)
    10.132.42.148.2049 > 10.132.42.85.871: Flags [S.], cksum 0x2967 (correct), seq 3548396325, ack 1435157683, win 65535, options [mss 1460,nop,wscale 6,sackOK,TS val 1375604124 ecr 1292227501], length 0
00:00:00.001210 IP (tos 0x0, ttl 64, id 13095, offset 0, flags [DF], proto TCP (6), length 52)
    10.132.42.85.871 > 10.132.42.148.2049: Flags [.], cksum 0x541f (correct), seq 1, ack 1, win 1040, options [nop,nop,TS val 1292227504 ecr 1375604124], length 0
00:00:00.000260 IP (tos 0x0, ttl 64, id 13096, offset 0, flags [DF], proto TCP (6), length 96)
    10.132.42.85.2847810760 > 10.132.42.148.2049: 40 null
00:00:00.000608 IP (tos 0x0, ttl 64, id 54778, offset 0, flags [DF], proto TCP (6), length 52)
    10.132.42.148.2049 > 10.132.42.85.871: Flags [.], cksum 0xe635 (correct), seq 1, ack 45, win 29127, options [nop,nop,TS val 1375604130 ecr 1292227504], length 0
00:00:00.000139 IP (tos 0x0, ttl 64, id 54779, offset 0, flags [DF], proto TCP (6), length 80)
    10.132.42.148.2049 > 10.132.42.85.2847810760: reply ok 24 null
00:00:00.001038 IP (tos 0x0, ttl 64, id 13097, offset 0, flags [DF], proto TCP (6), length 52)
    10.132.42.85.871 > 10.132.42.148.2049: Flags [F.], cksum 0x53d0 (correct), seq 45, ack 29, win 1040, options [nop,nop,TS val 1292227504 ecr 1375604130], length 0
00:00:00.000062 IP (tos 0x0, ttl 64, id 54780, offset 0, flags [DF], proto TCP (6), length 52)
    10.132.42.148.2049 > 10.132.42.85.871: Flags [.], cksum 0xe618 (correct), seq 29, ack 46, win 29127, options [nop,nop,TS val 1375604130 ecr 1292227504], length 0
00:00:00.000183 IP (tos 0x0, ttl 64, id 54781, offset 0, flags [DF], proto TCP (6), length 52)
    10.132.42.148.2049 > 10.132.42.85.871: Flags [F.], cksum 0xe617 (correct), seq 29, ack 46, win 29127, options [nop,nop,TS val 1375604130 ecr 1292227504], length 0
00:00:00.000332 IP (tos 0x0, ttl 64, id 13098, offset 0, flags [none], proto UDP (17), length 84)
    10.132.42.85.895 > 10.132.42.148.111: [udp sum ok] UDP, length 56
00:00:00.000557 IP (tos 0x0, ttl 64, id 13099, offset 0, flags [DF], proto TCP (6), length 52)
    10.132.42.85.871 > 10.132.42.148.2049: Flags [.], cksum 0x53cf (correct), seq 46, ack 30, win 1040, options [nop,nop,TS val 1292227504 ecr 1375604130], length 0
00:00:00.000555 IP (tos 0x0, ttl 64, id 54782, offset 0, flags [none], proto UDP (17), length 56)
    10.132.42.148.111 > 10.132.42.85.895: [udp sum ok] UDP, length 28

情報が不足している場合はお知らせください。

2
Samer

注:192.168.1.9はクライアントで、14はサーバーであり、2つのサーバーで正常に動作しています..。
クライアントpf.conf

block all
pass in on em0 inet proto { tcp udp } from 192.168.1.14 to em0 port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }
pass out on em0  inet proto { tcp udp } from em0 to 192.168.1.14 port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }

サーバーpf.conf

block all
pass in on em0 inet proto { tcp udp } from 192.168.1.9 to em0 port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }
pass out on em0 inet proto { tcp udp } from em0 to 192.168.1.9  port { sunrpc nfsd-status nfsd-keepalive nfsd lockd }
1
PersianGulf

これらのpfルールは私のために働きます。マウント用にポート797が追加されました。便利なガイドがあります PF:ファイアウォールのテスト

NFSクライアント:

- nfs_ports="{ sunrpc, nfsd-status, nfsd-keepalive, nfsd, lockd, 797 }"
- nfs_server="10.132.0.2"
- pass in on $ext_if proto tcp from $nfs_server to $ext_if port $nfs_ports keep state flags S/SA
- pass in on $ext_if proto udp from $nfs_server to $ext_if port $nfs_ports                                                                                                                  
- pass out on $ext_if proto tcp from $ext_if to $nfs_server port $nfs_ports keep state flags S/SA
- pass out on $ext_if proto udp from $ext_if to $nfs_server port $nfs_ports

NFSサーバー:

- nfs_ports="{ sunrpc, nfsd-status, nfsd-keepalive, nfsd, lockd, 797 }"
- nfs_clients="{ 10.132.0.3, 10.132.0.4 }"
- pass in on $ext_if proto tcp from $nfs_clients to $ext_if port $nfs_ports keep state flags S/SA
- pass in on $ext_if proto udp from $nfs_clients to $ext_if port $nfs_ports                                                                                                                  
- pass out on $ext_if proto tcp from $ext_if to $nfs_clients port $nfs_ports keep state flags S/SA
- pass out on $ext_if proto udp from $ext_if to $nfs_clients port $nfs_ports
0
Vladimir Botka