2008-07-18
One consequence of Linux's dynamic network device naming
I knew that Linux did dynamic network device naming, but one consequence of that only really sunk in recently. Dynamic naming is relatively predictable for interfaces that are always on (especially when various distributions work hard to make them very persistent), but where it can really surprise you (and your software) is when the interfaces are dynamic. Like, say, PPP interfaces.
Just like Ethernet interfaces, the first active PPP connection gets
ppp0, the second one gets ppp1, and so on. But unlike Ethernets,
PPP connections can routinely come and go, and as a result it may not
be clear to you (or your software) what PPP device is what connection.
Also, it is easier to commit the old mistake of trying to bring up a
connection that's configured as ppp1 when you don't have a ppp0.
(Scripts run by pppd itself get told the right network device, which
can be both useful and potentially confusing.)
Unfortunately it looks like you cannot rename PPP devices, because it
seems that you can only rename network devices that aren't active and
when a PPP device isn't active, it doesn't exist at all. So I can't
have pppdialup0 and pppdsl0 instead of, well, whatever pppN name
they get right now.
One can half-fix this with software; pppd has a concept of a logical
link name, and contrary to what the manual page appears to claim, it
does pass this information to the ip-up script as the environment
variable $LINKNAME. So your local link-up script can save the mapping
between actual PPP device (the first argument) and the logical link name
somewhere, and then other things can read it.