[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Recommendations for network autoconfiguration



begin  Seneca <seneca-cunningham@rogers.com> wrote:
> I have a 10baseT USB NIC (pegasus), a 10/100baseT PCMCIA NIC (axnet_cs),
> and an 802.11b PCMCIA adapter (orinoco_cs), with all drivers as modules.
> What I want the autoconfigurator to be able to do is allow for delays to
> be specified between module loading and configuration, have only one of
> the three interfaces active at any given time with the active interface
> being determined by when it was inserted and which interface it is,

Maybe you can use guessnet (+ifplugd) instead. This can check if the
expected network is reachable at the interface and bring it up if so.

> automatic reconfiguration on certain timeout patterns, different WEP
> keys used on different networks, and different configurations for stuff
> like printing for the different networks.  All of the networks that this

I had the same problem and found a solution (for me) with ifupdown. I
wrote all data, which I want in /e/n/interfaces and configure the system
when the interface comes up.

,----[ /etc/network/interfaces ]---
| iface home inet static
| 	address 192.168.0.5
| 	netmask 255.255.255.0
| 	gateway 192.168.0.1
| 	newsserver server.localnet
| 	smarthost server.localnet
| 	http_proxy server.localnet:8080
| 	ftp_proxy server.localnet:8080
| 	domain localnet
| 	nameserver 192.168.0.1
| 	ntpserver server.localnet
| 	test-peer address 192.168.0.1 mac 00:00:cb:56:04:ae
| 
| iface fsu inet dhcp
| #        leasehours 6
|       newsserver news.uni-jena.de
| 	smarthost smtp.uni-jena.de
| 	ntpserver timesrv1.uni-jena.de
| 	test-peer address 141.35.184.1
| 	up vpnc-connect fsu
| 	down vpnc-disconnect || true
`----

,----[ /etc/network/if-up.d/00config ]---
| #!/bin/sh
| #
| 
| if [ "$METHOD" != dhcp ]; then
|     if [ -n "$IF_DOMAIN" ]; then
|         grep -v ^domain /etc/resolv.conf > /etc/resolv.conf.new
|     	{ echo "domain $IF_DOMAIN"; cat /etc/resolv.conf.new; } > /etc/resolv.conf
| 	rm /etc/resolv.conf.new
|     fi
|     if [ -n "$IF_NAMESERVER" ]; then
|         echo "nameserver $IF_NAMESERVER" >> /etc/resolv.conf
|     fi
| fi
| 
| if [ -w /etc/news/server -a -n "$IF_NEWSSERVER" ]; then
|     echo $IF_NEWSSERVER > /etc/news/server
| fi
| 
| if [ -n "$IF_SMARTHOST" ]; then
|     echo "$IF_SMARTHOST" > /etc/exim4/smarthost
| fi
| 
| if [ -n "$IF_FTP_PROXY$IF_HTTP_PROXY" ]; then
|     printf "${IF_FTP_PROXY:+ftp_proxy=$IF_FTP_PROXY\n}${IF_HTTP_PROXY:+http_proxy=$IF_HTTP_PROXY\n}" >> /etc/environment
| fi
`----

,----[ /etc/network/if-down.d/99unconfig ]---
| #!/bin/sh
| #
| 
| if [ "$METHOD" = dhcp ]; then
|     : > /etc/resolv.conf
| fi
| 
| if [ "$METHOD" != dhcp -a -n "$IF_DOMAIN$IF_NAMESERVER" ]; then
|     grep -v "^domain $IF_DOMAIN\$\|^nameserver $IF_NAMESERVER\$" \
|       /etc/resolv.conf > /etc/resolv.conf.new
|     mv /etc/resolv.conf.new /etc/resolv.conf
| fi
| 
| if [ -n "IF_NEWSSERVER" -a "$(cat /etc/news/server)" = "$IF_NEWSSERVER" ]; then
|     : > /etc/news/server
| fi
| 
| if [ -n "IF_SMARTHOST" -a "$(cat /etc/exim4/smarthost)" = "$IF_SMARTHOST" ]; then
|     rm -f /etc/exim4/smarthost
| fi
| 
| if [ -n "$IF_FTP_PROXY$IF_HTTP_PROXY" ]; then
|     grep -v "^ftp_proxy=$IF_FTP_PROXY\$\|^http_proxy=$IF_HTTP_PROXY\$" \
|       /etc/environment > /etc/environment.new
|     mv /etc/environment.new /etc/environment
| fi
`----

Maybe is exists a package that do this, but I didn't find it.

Bye, Joerg.
end.
-- 
$ cat /dev/random
#!/usr/bin/perl -WT
print "hello world\n";



Reply to: