Use puppet to make changes to ip route and sysctl
Going off of larsks answer, if you have static ip addresses, place this in /sbin/ifup-local
#!/bin/sh
GATEWAY=`ip route| awk '/^def/{print $3}'`
DEFGWDEV=`ip route| awk '/^def/{print $5}'`
if [ "$1" = $DEFGWDEV ]; then
ip route change default via $GATEWAY dev $DEFGWDEV initcwnd 12
fi
If you are obtaining your internet address using DHCP (which is suggested by your question), then you can use /etc/dhcp/dhclient-exit-hooks
to run shell commands after dhclient
configures your interface. You'll have access to a number of variables provided by dhclient, including $router
. You can use this to run:
ip route change default via $router dev $interface initcwnd 12
You would install this script with a normal Puppet file
resource:
file { '/etc/dhcp/dhclient-exit-hooks':
owner => root,
group => root,
mode => 0755,
source => 'puppet:///.../dhclient-exit-hooks',
}
And the file contents would probably look something like:
#!/bin/sh
if [ "$interface" = eth0 ]; then
ip route change default via ${new_routers%% *} dev $interface initcwnd 12
fi
If you're not using DHCP, you can do something similar. The normal ifup
script runs /sbin/ifup-local
after configuring the interface, and you could use this to run the ip
command. In this case, you could get the address of the default gateway simply by sourcing in the interface configuration in /etc/sysconfig/network-scripts/ifcfg-eth0
(and your Puppet file
resource would install /sbin/ifup-local
).