Skip to content

Instantly share code, notes, and snippets.

@jsravn
jsravn / ConnectionDrainingFilter.java
Last active December 4, 2017 20:37
ConnectionDrainingFilter.java
/*
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
jsravn / ip_vs_sh-fixed.c
Created December 24, 2017 21:54
ip_vs_sh with fixed hash shift
/*
* IPVS: Source Hashing scheduling module
*
* Authors: Wensong Zhang <wensong@gnuchina.org>
*
* 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
jsravn / interfaces
Created June 12, 2018 12:46
/etc/network/interfaces
# The loopback network interface
auto lo
iface lo inet loopback
# vdsl modem / wan port
auto eth0
iface eth0 inet static
address 192.168.10.2
netmask 255.255.255.0
# to support jumbo frames on ppp (1500 mtu + 8 byte PPPoE overhead)
@jsravn
jsravn / ethtool
Created June 12, 2018 12:50
etc/ppp/ip-up.d/ethtool
#!/bin/sh
/sbin/ethtool -K ppp0 gro off gso off
ppp0 1 full full 1 default,fq_codel
ifb0:2 1 full full 1 default,fq_codel
# 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
@jsravn
jsravn / init
Last active June 12, 2018 12:58
# Setup ifb to ratelimit upload for fq_codel.
modprobe ifb numifbs=1
ip link set ifb0 up
# 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
ppp0 192.168.0.0/16,10.10.3.0/24
eth0
#SOURCE DESTINATION POLICY LOGLEVEL BURST
wan all DROP
fw all ACCEPT
lan all ACCEPT
all all REJECT