I'm currently trying to route a 56k connection, which is connected to a PSTN off a microwave transmitter, through a laptop to some ethernet enabled equipment. Essentially I'm using a laptop as a router utilizing a persistant route until proper routing equipment can be flown in. I can connect, route, perform data transfer between my remote points, and the 33kbs is plenty enough bandwidth for my needs using the following route:
route add -p 192.168.2.0 mask 255.255.255.0 192.0.16.1 if 0x10004
However, if the modem is forced to redial the interface index on the 56k modem changes (0x10004 -> 0xa0004 -> 0xc0004 -> etc) and the route is invalidated.
If I don't specifiy the route, the route add
fails with the message that the index is wrong or the gateway isn't on the same interface.
Is there any way to route the 56k connection independant of the interface index to my ethernet interface?
I ended up writing a small application with the super creative name DialupRouteMaster.
It checks the destination gateway to see if the route is alive (not in a disconnected state) and if the network is disconnected (redialing, etc) then it attempts to remove the persistent route then recreate it with the correct interface. I unfortunately tried as Geoff suggested, and it is the recommended way to create the route, but if it doesn't work, you'll have to try something else.
You should be able to leave off the interface, like so:
And it will use whatever interface it uses to reach 192.0.16.1. It even states that in the help dialog:
However, I don't know if it's adaptable enough to retain the permanent route when it becomes invalid, then re-instate it when the interface comes back. If it's not, I would think your only recourse is triggering a script to add the route once it's done dialing...