Forum Moderators: bakedjake
For some reason, I think after I added some entries in my hosts file like 10.0.0.1 ad.doubleclick.net and a reject route for the 10.0.0.0 network the default routing configuration stopped working.
I now have to run something like this to get it to work:
net=`route -n ¦ awk '{ print $1; }' ¦ grep -e "^0\.0\.0\.0"`
if [! "$net" ]; then
route add -net 0.0.0.0 gw emo $eth
fi
net=`route -n ¦ awk '{ print $1; }' ¦ grep "192.168.0.0"`
if [! "$net" ]; then
route add -net 192.168.0.0 netmask 255.255.255.0 $eth
fi
net=`route -n ¦ awk '{ print $1; }' ¦ grep "10.0.0.0"`
if [! "$net" ]; then
route add -net 10.0.0.0 netmask 255.0.0.0 reject
fi
net=`route -n ¦ awk '{ print $1; }' ¦ grep "64.94.110.11"`
if [! "$net" ]; then
route add -host 64.94.110.11 reject
fi
The problem is that for some reason the default route isn't set on the first run and I have to run the script twice to get it to work... but anyway that's a kind of a workaround. I was wondering if there's a cleaner way to set up routing, I tried /etc/gateways but it doesn't work.