divine1
Guess the current networking setup
Usage
divine [eth0]
Overview
Divine is meant for mobile setups, where the same machine is carried around and used in more than one network, but you have fixed IP addresses in all those networks. Many people use IP aliases or write crude shell scripts to switch the IP setup manually, but a better solution would be to specify your IP number in every network and a few other IP numbers and then run a program that simply checks all the given IP numbers and sees which answers. This way you can reliably find out in which network you actually are and thus set the networking options accordingly.
If no arp replies are found, divine will re-send the ARP queries. This is useful for laptops with 10/100 MBit Ethernet cards that need some time to negotiate the speed. There are 3 retries before divine gives up and leaves the network setup as-is. I used POSIX threads to implement this.
Divine can also run a user-specified script dependant on the network setup found, so you can also change /etc/issue or somehow set the default printer or do whatever you want.
Options
- [eth0]
-
You can optionally specify the network interface to use. If none is given, divine chooses the first non-loopback device it finds.
Installation
divine is normally installed in /etc/pcmcia/network.opts in start_fn. I use
- start_fn () { /usr/sbin/divine; return; }
Releases
Unchanged in 3 releases since Debian 2.2 (Potato).