On Mon, Nov 30, 2009 at 09:16:47PM +0100, Moritz Herrmann wrote: > Hello misc, > I am using OBSD on my Laptop and as I use internet > connections at different places (home, work, university), > I always have to change my ip-adress and default route after startup. > To ease the pain a littlebit > I wrote three scripts that I run manually after startup: > #bin/sh > route delete default > ifconfig em0 inet 192.168.0.44 netmask 255.255.255.0 > route add default 192.168.0.1 > > This works quite well, but I am getting tired of doing this 10 times a day, > so I reread the ifconfig manual and found the alias function. > I managed to add two aliases for my NIC, but still I have to configure the > default route every time. > > Is there a way to add permanent "default routes", so that the system > automatically > uses the suitable gateway for the current subnet?
I'm pretty sure you're SOL on that, but you could give your script some smarts and have it pull the default route from a file (I'm assuming your potential universe of static routes is tiny) and do the jiggery-pokery automagically. IIRC, there was something on Undeadly lo these many moons ago which did more or less that. > > I tried something like "route add 192.168.100.0/24 192.168.0.1", but > it doesn't work. > > Thank you in advance > > Moritz