Alternative Pccard_Ether
(for when you move betwen networks)
Richard Caley, 6th December 2001

OK, so the Right Thing is ro run DHCP. However it is not always reasonable to demand that someone set up a whole new service when you want to plug in your laptop to swap some files. On the other hand you don't want to overwrite your current rc.conf settings.

The solution here is to try to ping a local machine (ie on the same network segment) whose presence will determine th network you are on.

Here is an extract from rc.conf. The pccard_ether_configs line lists places you might plug the machine in, then for each there is an address, a default router and a test machine (which defaults to the default router).

And here is my version of /etc/pccard_ether.

When a card is inserted it checks each config to see if the test machine is there. Just for the fun of it it prints stuff in colour to say what it is doing, the effect is somewhat lost at boot time as there are lots of other things printing at the same time, but good for testing.

When a card is removed it uses a file created on insertion to know what to undo.

Notes:

  • It pings twice. This seems to be necessary for some switches which don't know what is what for the first ICMP packet.

See Also:


Richard Caley / PCCARD_Ether / 6th December 2001