Skip to content

Instantly share code, notes, and snippets.

jsravn /
Last active Dec 4, 2017
Copyright (c) 2017, Sky UK Ltd All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
jsravn / ip_vs_sh-fixed.c
Created Dec 24, 2017
ip_vs_sh with fixed hash shift
View ip_vs_sh-fixed.c
* IPVS: Source Hashing scheduling module
* Authors: Wensong Zhang <>
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version
* 2 of the License, or (at your option) any later version.
jsravn / interfaces
Created Jun 12, 2018
View interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# vdsl modem / wan port
auto eth0
iface eth0 inet static
# to support jumbo frames on ppp (1500 mtu + 8 byte PPPoE overhead)
jsravn / ethtool
Created Jun 12, 2018
View ethtool
/sbin/ethtool -K ppp0 gro off gso off
View tcclasses
ppp0 1 full full 1 default,fq_codel
ifb0:2 1 full full 1 default,fq_codel
View tcdevices
# This should be set to slightly less than your raw upload speed.
ppp0 0 19mbit
# This should be set to slightly less than your raw download speed.
ifb0 0 72mbit classify ppp0
View init
# Setup ifb to ratelimit upload for fq_codel.
modprobe ifb numifbs=1
ip link set ifb0 up
View interfaces
# wan is setup with some basic filtering settings.
wan ppp0 detect routefilter,tcpflags
# lan is bridged and uses dhcp.
lan br0 detect dhcp,bridge
# modem is a separate interface for direct access to the vDSL UI.
modem eth0
View masq
View rules
# allow certain ICMP to not break TCP and pings
ACCEPT wan fw icmp 0,3,4,8,11
# example port forwarding
DNAT wan lan: tcp 2628
DNAT wan lan: udp 2628