# PPP connection to my ISP (Plusnet FTTC) is slow



## stocksy (Mar 11, 2013)

I am using FreeBSD 9.0-RELEASE on my Soekris net5501.  I have been using this machine as my network gateway for several years.

I have just changed from an ISP which provided a straightforward IP connection to one which requires PPPoE.  The ISP provides a Huawei HG612 VDSL modem, which is paired with a Technicolor (Thomson) TG582n router.  I would rather not use the TG582 since it is very basic, so I have connected my FreeBSD machine directly to the HG612.

My PPPoE connection from FreeBSD establishes OK and I get an internet IP on tun0, but throughput is rather slow.  Using the ISP-supplied router, I am getting speeds of around 75Mb/s down and 18Mb/s up, but when I establish the PPP link from my FreeBSD machine, I am getting download speeds of only 2 or 3 Mb/s.  The odd part â€“ upload speeds are almost unchanged, I'm still getting around 16Mb/s.  I am measuring the speed by transferring an 80MB file through HTTP to and from a leased server I control which has a 100Mb internet connection.

This is the ppp.conf I'm using:


```
infinity:
 set device PPPoE:vr0
 set speed sync
 set mru 1492
 set mtu 1492
 set ctsrts off
 enable echo
 set echoperiod 15
 enable lqr
 set lqrperiod 15
 set log Phase tun
 enable ipcp
 disable dns
 set server /tmp/pppoe-vr0 "" 0177
 set authname myauthname@my.isp
 set authkey mypassword
 # HISADDR is shorthand for the remote end of the link,
 # pppd will set this as the default route
 add! default HISADDR
```

Are there some settings in PPP I need to tune in order to get reasonable performance?  Are there some other details of my system I should examine?  I am unsure where to focus my attention.


----------



## stocksy (Mar 12, 2013)

OK after a little more investigation I think the PPP connection is a red herring.  I have set up a third interface on the router and straightforward routing between my LAN on vr1 and test host connected to vr2 shows the same problem.  I read that using polling on the vr interfaces could help, but that made no difference.  I think it might be some change I've made in the past but just didn't notice the effect straight away.  I am going to try stripping down my kernel to the bare essentials (pf) and get back as close as possible to the GENERIC kernel to see if this improves things.

In the mean time, for the sake of completeness, this is the kernel configuration I'm using incase I've made an obvious blunder:


```
cpu		I486_CPU
cpu		I586_CPU
cpu		I686_CPU
ident		STOCKSY

makeoptions	DEBUG=-g		# Build kernel with gdb(1) debug symbols

options 	SCHED_ULE		# ULE scheduler
options 	PREEMPTION		# Enable kernel thread preemption
options 	INET			# InterNETworking
options 	INET6			# IPv6 communications protocols
options 	SCTP			# Stream Control Transmission Protocol
options 	FFS			# Berkeley Fast Filesystem
options 	SOFTUPDATES		# Enable FFS soft updates support
options 	UFS_ACL			# Support for access control lists
options 	UFS_DIRHASH		# Improve performance on big directories
options 	UFS_GJOURNAL		# Enable gjournal-based UFS journaling
options 	MD_ROOT			# MD is a potential root device
options 	NFSCL			# New Network Filesystem Client
options 	NFSD			# New Network Filesystem Server
options 	NFSLOCKD		# Network Lock Manager
options 	NFS_ROOT		# NFS usable as /, requires NFSCL
options 	MSDOSFS			# MSDOS Filesystem
options 	CD9660			# ISO 9660 Filesystem
options 	PROCFS			# Process filesystem (requires PSEUDOFS)
options 	PSEUDOFS		# Pseudo-filesystem framework
options 	GEOM_PART_GPT		# GUID Partition Tables.
options 	GEOM_LABEL		# Provides labelization
options 	COMPAT_FREEBSD4		# Compatible with FreeBSD4
options 	COMPAT_FREEBSD5		# Compatible with FreeBSD5
options 	COMPAT_FREEBSD6		# Compatible with FreeBSD6
options 	COMPAT_FREEBSD7		# Compatible with FreeBSD7
options 	SCSI_DELAY=5000		# Delay (in ms) before probing SCSI
options 	KTRACE			# ktrace(1) support
options 	STACK			# stack(9) support
options 	SYSVSHM			# SYSV-style shared memory
options 	SYSVMSG			# SYSV-style message queues
options 	SYSVSEM			# SYSV-style semaphores
options 	_KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options 	PRINTF_BUFR_SIZE=128	# Prevent printf output being interspersed.
options 	KBD_INSTALL_CDEV	# install a CDEV entry in /dev
options 	HWPMC_HOOKS		# Necessary kernel hooks for hwpmc(4)
options 	AUDIT			# Security event auditing
options 	MAC			# TrustedBSD MAC Framework
#options 	KDTRACE_HOOKS		# Kernel DTrace hooks
options 	INCLUDE_CONFIG_FILE     # Include this file in kernel
options 	KDB			# Kernel debugger related code
options 	KDB_TRACE		# Print a stack trace for a panic

# To make an SMP kernel, the next two lines are needed
#options 	SMP			# Symmetric MultiProcessor Kernel
#device		apic			# I/O APIC

# CPU frequency control
device		cpufreq

# Bus support.
device		acpi
device		eisa
device		pci

# Floppy drives
device		fdc

# ATA controllers
device		ahci		# AHCI-compatible SATA controllers
device		ata		# Legacy ATA/SATA controllers
options 	ATA_CAM		# Handle legacy controllers with CAM
options 	ATA_STATIC_ID	# Static device numbering
device		mvs		# Marvell 88SX50XX/88SX60XX/88SX70XX/SoC SATA
device		siis		# SiliconImage SiI3124/SiI3132/SiI3531 SATA

# ATA/SCSI peripherals
device		scbus		# SCSI bus (required for ATA/SCSI)
device		ch		# SCSI media changers
device		da		# Direct Access (disks)
device		sa		# Sequential Access (tape etc)
device		cd		# CD
device		pass		# Passthrough device (direct ATA/SCSI access)
device		ses		# SCSI Environmental Services (and SAF-TE)

# atkbdc0 controls both the keyboard and the PS/2 mouse
device		atkbdc		# AT keyboard controller
device		atkbd		# AT keyboard
device		psm		# PS/2 mouse

device		kbdmux		# keyboard multiplexer

device		vga		# VGA video card driver

device		splash		# Splash screen and screen saver support

# syscons is the default console driver, resembling an SCO console
device		sc
options 	SC_PIXEL_MODE	# add support for the raster text mode

device		agp		# support several AGP chipsets

# Power management support (see NOTES for more options)
#device		apm
# Add suspend/resume support for the i8254.
device		pmtimer

# PCCARD (PCMCIA) support
# PCMCIA and cardbus bridge support
device		cbb		# cardbus (yenta) bridge
device		pccard		# PC Card (16-bit) bus
device		cardbus		# CardBus (32-bit) bus

# Serial (COM) ports
device		uart		# Generic UART driver

# Parallel port
device		ppc
device		ppbus		# Parallel port bus (required)

# PCI Ethernet NICs that use the common MII bus controller code.
# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs!
device		miibus		# MII bus support
device		vr		# VIA Rhine, Rhine II

# Pseudo devices.
device		loop		# Network loopback
device		random		# Entropy device
device		ether		# Ethernet support
device		vlan		# 802.1Q VLAN support
device		tun		# Packet tunnel.
device		pty		# BSD-style compatibility pseudo ttys
device		md		# Memory "disks"
device		gif		# IPv6 and IPv4 tunneling
device		faith		# IPv6-to-IPv4 relaying (translation)
device		firmware	# firmware assist module

# The `bpf' device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
# Note that 'bpf' is required for DHCP.
device		bpf		# Berkeley packet filter

# USB support
options 	USB_DEBUG	# enable debug msgs
device		uhci		# UHCI PCI->USB interface
device		ohci		# OHCI PCI->USB interface
device		ehci		# EHCI PCI->USB interface (USB 2.0)
device		xhci		# XHCI PCI->USB interface (USB 3.0)
device		usb		# USB Bus (required)
#device		udbp		# USB Double Bulk Pipe devices (needs netgraph)
device		uhid		# "Human Interface Devices"
device		ukbd		# Keyboard
device		umass		# Disks/Mass storage - Requires scbus and da

# Sound support
device		sound		# Generic sound driver (required)

# stocksy changes
options		CPU_SOEKRIS
options		CPU_GEODE
device		pf
device		pflog
device		pfsync
# Interface Polling
options 	DEVICE_POLLING
options 	HZ=1000
# QoS
options         ALTQ
options         ALTQ_CBQ        # Class Bases Queuing (CBQ)
options         ALTQ_RED        # Random Early Detection (RED)
options         ALTQ_RIO        # RED In/Out
options         ALTQ_HFSC       # Hierarchical Packet Scheduler (HFSC)
options         ALTQ_PRIQ       # Priority Queuing (PRIQ)
# IPSec related bilge
options 	IPSEC 		#IP security
options 	IPSEC_FILTERTUNNEL
options 	IPSEC_NAT_T
device 		crypto
device 		enc
# Multiple routing tables / FIBs / setfib
options         ROUTETABLES=2
```


----------



## stocksy (Mar 15, 2013)

Solved!

PPP was taking around 30% of the CPU and causing the throughput to oscillate up and down dramatically. I solved this by using the mpd5 port and configuring it to start the PPP connection. This is much faster because it is not handled in user space like the standard PPP daemon is. Here is the mpd.conf


```
infinity:
 create bundle static B1
 set iface name tun0
 set iface enable tcpmssfix 
# set iface up-script /usr/local/etc/mpd5/up-script_fib_0.sh
# set iface down-script /usr/local/etc/mpd5/down-script_fib_0.sh
 set iface route default
 set ipcp ranges 0.0.0.0/0 0.0.0.0/0
 create link static L1 pppoe
 set link action bundle B1
 set auth authname myuser@plusdsl.net
# put the password in mpd.secret
#  set auth password PPPOE_PASSWORD
 set link max-redial 0
 set link mtu 1492
 set link mru 1492
 set link keep-alive 10 60
# interface to PPPoE
 set pppoe iface vr0 
 set pppoe service ""
# start connection
 open
```

Then, it just needs an entry in the default section to start the PPP connection when mpd5 starts. 


```
default:
   load infinity
```

Getting great throughput now up to 77Mb, the limit of my FTTC connection.


----------

