Skip to content

Instantly share code, notes, and snippets.

@jsravn
jsravn / ConnectionDrainingFilter.java
Last active Dec 4, 2017
ConnectionDrainingFilter.java
View 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 Dec 24, 2017
ip_vs_sh with fixed hash shift
View ip_vs_sh-fixed.c
/*
* 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 Jun 12, 2018
/etc/network/interfaces
View 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 Jun 12, 2018
etc/ppp/ip-up.d/ethtool
View ethtool
#!/bin/sh
/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
ppp0 192.168.0.0/16,10.10.3.0/24
eth0
View policy
#SOURCE DESTINATION POLICY LOGLEVEL BURST
wan all DROP
fw all ACCEPT
lan all ACCEPT
all all REJECT