On 09/03/2010 02:09 PM, Bob Proulx wrote:
David A. Parker wrote:I have a Debian Lenny box with two NICs, eth0 and eth1. eht1 is a trunking interface and can be put onto any VLAN. Whenever eth1 is put onto a VLAN, I want it to get an address from DHCP but I do *not* want it to set a default gateway. ... Any help would be greatly appreciated.By coincidence I have been hacking on these scripts today too... The dhclient-script sets the route. If you want to prevent it then you will have to either prevent dhclient-script from setting it or to remove it after it has been set.
Thanks, Bob. I had looked at dhclient-script and realized that it was the culprit, but I was hoping to avoid hacking up that script. I tried adding a line to my post-up script to remove the default route, like so:
route del -net 10.5.2.0/24 gw 0.0.0.0 dev vlan52But this removes the static route instead! I don't know why it's behaving like that.
It appears that I can delete both routes, but only in a certain order. I can only delete the default route once the static route is gone. And if I don't have any routes for that network, "route" won't let me add the static route unless a default route is already there. I have to add the default route first, and then I can add the static one. So, if I stop dhclient from adding the default route, it seems like this would prevent my post-up script from being able to add the static route.
I'm very confused by this. Does the kernel absolutely require a default route for every network the host is on? Because that's exactly what I'm trying to avoid.
Thanks, Dave -- Dave Parker Systems Administrator Utica College Integrated Information Technology Services (315) 792-3229 Registered Linux User #408177