Hello everybody,
I'm running 8.2-RELEASE with an Intel Gigabit CT Desktop Adapter (82574) NIC and a PF firewall.
With the PF firewall enabled, throughput is approximately 6.3 MB/s according to benchmarks/iperf:
With the firewall disabled, throughput jumps to 11.1 MB/s, which is, in effect, the maximum speed of the internal network:
Copying larger files over SMB or scp(1) also result in similar speeds.
My /etc/pf.conf is as follows (tun0 is a Huawei 3G USB modem):
Does anyone have any ideas why network throughput is so poor with PF enabled, and is there anything I could do to remedy the problem? Any settings to check or tunables to tweak?
I'm running 8.2-RELEASE with an Intel Gigabit CT Desktop Adapter (82574) NIC and a PF firewall.
Code:
FreeBSD microserver 8.2-RELEASE FreeBSD 8.2-RELEASE #0: Thu Feb 17 02:41:51 UTC 2011 root@mason.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64
Code:
em0: <Intel(R) PRO/1000 Network Connection 7.1.9> port 0xe800-0xe81f mem 0xfe8e0000-0xfe8fffff,0xfe800000-0xfe87ffff,0xfe8dc000-0xfe8dffff irq 16 at device 0.0 on pci2
em0: Using MSIX interrupts with 3 vectors
em0: [ITHREAD]
em0: [ITHREAD]
em0: [ITHREAD]
em0: Ethernet address: 00:1b:21:xx:xx:xx
Code:
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
options=219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC>
ether 00:1b:21:xx:xx:xx
inet 10.0.0.15 netmask 0xffffff00 broadcast 10.0.0.255
media: Ethernet autoselect (100baseTX <full-duplex>)
status: active
With the PF firewall enabled, throughput is approximately 6.3 MB/s according to benchmarks/iperf:
Code:
------------------------------------------------------------
Client connecting to 10.0.0.15, TCP port 5001
TCP window size: 0.13 MByte (default)
------------------------------------------------------------
[ 3] local 10.0.0.11 port 64306 connected with 10.0.0.15 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 1.0 sec 5.50 MBytes 5.50 MBytes/sec
[ 3] 1.0- 2.0 sec 6.50 MBytes 6.50 MBytes/sec
[ 3] 2.0- 3.0 sec 6.38 MBytes 6.38 MBytes/sec
[ 3] 3.0- 4.0 sec 6.38 MBytes 6.38 MBytes/sec
[ 3] 4.0- 5.0 sec 6.38 MBytes 6.38 MBytes/sec
[ 3] 5.0- 6.0 sec 6.38 MBytes 6.38 MBytes/sec
[ 3] 6.0- 7.0 sec 6.38 MBytes 6.38 MBytes/sec
[ 3] 7.0- 8.0 sec 6.25 MBytes 6.25 MBytes/sec
[ 3] 8.0- 9.0 sec 6.38 MBytes 6.38 MBytes/sec
[ 3] 9.0-10.0 sec 6.25 MBytes 6.25 MBytes/sec
[ 3] 0.0-10.0 sec 62.9 MBytes 6.28 MBytes/sec
With the firewall disabled, throughput jumps to 11.1 MB/s, which is, in effect, the maximum speed of the internal network:
Code:
------------------------------------------------------------
Client connecting to 10.0.0.15, TCP port 5001
TCP window size: 0.13 MByte (default)
------------------------------------------------------------
[ 3] local 10.0.0.11 port 64268 connected with 10.0.0.15 port 5001
[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 1.0 sec 11.2 MBytes 11.2 MBytes/sec
[ 3] 1.0- 2.0 sec 11.1 MBytes 11.1 MBytes/sec
[ 3] 2.0- 3.0 sec 11.2 MBytes 11.2 MBytes/sec
[ 3] 3.0- 4.0 sec 11.1 MBytes 11.1 MBytes/sec
[ 3] 4.0- 5.0 sec 11.2 MBytes 11.2 MBytes/sec
[ 3] 5.0- 6.0 sec 11.1 MBytes 11.1 MBytes/sec
[ 3] 6.0- 7.0 sec 11.2 MBytes 11.2 MBytes/sec
[ 3] 7.0- 8.0 sec 11.1 MBytes 11.1 MBytes/sec
[ 3] 8.0- 9.0 sec 11.1 MBytes 11.1 MBytes/sec
[ 3] 9.0-10.0 sec 11.2 MBytes 11.2 MBytes/sec
[ 3] 0.0-10.0 sec 112 MBytes 11.2 MBytes/sec
Copying larger files over SMB or scp(1) also result in similar speeds.
My /etc/pf.conf is as follows (tun0 is a Huawei 3G USB modem):
Code:
int_if="em0"
ext_if="tun0"
int_gw="10.0.0.2"
icmp_types="{ echoreq, unreach }"
martians = "{ 127.0.0.0/8, 192.168.0.0/16, 172.16.0.0/12, \
10.0.0.0/8, 169.254.0.0/16, 192.0.2.0/24, \
0.0.0.0/8, 240.0.0.0/4 }"
set block-policy return
set loginterface $ext_if
set skip on lo
scrub in all
block in log
pass out all
antispoof quick for { $int_if $ext_if }
block drop in quick on $ext_if from $martians to any
block drop out quick on $ext_if from any to $martians
pass in inet proto icmp all icmp-type $icmp_types
# Enforce symmetric routing for incoming connections on $int_if
pass in on $int_if reply-to ($int_if $int_gw)
Does anyone have any ideas why network throughput is so poor with PF enabled, and is there anything I could do to remedy the problem? Any settings to check or tunables to tweak?