# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The routes added here will not be visible to the 'route' command; you
# should use 'ip route show table foo' instead.

auto eth0
iface eth0 inet static
	address 129.97.134.42
	netmask 255.255.255.0
	gateway 129.97.134.1

	# campus routes are checked first and are maintained here
	up   ip rule add from all lookup campus prio 1
	down ip rule del from all lookup campus prio 1
	up   ip route add 129.97.0.0/16  via 129.97.134.1 dev eth0 table campus realm campus
	down ip route del 129.97.0.0/16  via 129.97.134.1 dev eth0 table campus realm campus
	up   ip route add 10.0.0.0/8     via 129.97.134.1 dev eth0 table campus realm campus
	down ip route del 10.0.0.0/8     via 129.97.134.1 dev eth0 table campus realm campus
	up   ip route add 172.16.0.0/20  via 129.97.134.1 dev eth0 table campus realm campus
	down ip route del 172.16.0.0/20  via 129.97.134.1 dev eth0 table campus realm campus
	up   ip route add 192.168.0.0/16 via 129.97.134.1 dev eth0 table campus realm campus
	down ip route del 192.168.0.0/16 via 129.97.134.1 dev eth0 table campus realm campus

	# orion routes are checked second and are maintained by a cronjob
	up   ip rule add from all lookup orion prio 2
	down ip rule del from all lookup orion prio 2

	# Traffic shaping - 100M cogent, 200M orion, 700M campus.
	# Note that the border router is configured with a similar policy, but will
	# drop rather than queue excess packets. These rules keep them from dropping.
	up   tc qdisc  add dev eth0 parent root handle 1: htb default 2 r2q 10000
	up   tc class  add dev eth0 parent 1:   classid 1:1 htb rate 1000Mbit
	up   tc class  add dev eth0 parent 1:1  classid 1:2 htb rate 100Mbit
	up   tc class  add dev eth0 parent 1:1  classid 1:3 htb rate 200Mbit
	up   tc class  add dev eth0 parent 1:1  classid 1:4 htb rate 700Mbit ceil 1000Mbit
	up   tc filter add dev eth0 parent 1:   protocol ip pref 2 route to orion  flowid 1:3
	up   tc filter add dev eth0 parent 1:   protocol ip pref 1 route to campus flowid 1:4
	down tc qdisc  del dev eth0 parent root

auto eth0:mirror
iface eth0:mirror inet static
	address 129.97.134.71
	netmask 255.255.255.0
