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

Re: Network interface sanity

On Sunday 02 April 2006 19:32, Andreas Ehn wrote:
> Hi,
> I have a laptop with one wired ethernet interface (eth0) and one
> wireless interface (eth1). I'm using ifupdown.
> When the computer is not connected to a wired network, while starting
> up, it is associated with my wireless network and requests and receives
> an IP address with DHCP.
> That, however, doesn't satisfy the machine. It proceeds by requesting an
> address for the wired network as well, despite there being no attached
> network cable, which holds up the boot process until the DHCP client
> times out and gives up.
> What I would like to happen in this situation is that the machine would
> only try to get an address over the wired network interface if it is
> actually connected to a network. Otherwise it should try the wireless
> interface directly.
> Iff connected to a wired network, the system should only try to connect
> to a wireless network after having failed to acquire an IP address from
> the wired network.
> I would like all of this to happen automatically.
> Is it possible to configure /etc/interfaces like this? Reading
> interfaces(5) and the examples in /usr/share/doc/ifupdown didn't help
> me.
> Thanks,
> Andreas

I use a combination of guessnet, ifplugd, and resolvconf to work with 3 
different networks - two wired and one wireless.

ifplugd detects whether or not I have a wired connection.
guessnet determines which wired network I am connected to based on pinging 
some known machines with certain MAC addresses.
resolvconf deals with the changing dns information.

My work network uses dhcp (wired), my home network uses static ip (wired), and 
I also have wireless at work.

You end up modifying the /etc/network/interfaces to getting everything to 

Here is a sample bit from my network interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
# turn off since ifplugd is controlling things
#auto eth0

mapping eth0
        script /usr/sbin/guessnet-ifupdown
        map default: none
        map timeout: 3
        map verbose: true

iface work inet dhcp
        test peer address *.*.*.* #:#:#:#:#:#
        pre-up hostname my_machine_name

iface home inet static
        address *.*.*.*
        dns-nameservers *.*.*.*
        test peer address *.*.*.* #:#:#:#:#:#
        pre-up hostname machine_name

iface wlan0 inet dhcp
        pre-up modprobe ndiswrapper
#        pre-up modprobe acx-pci
        pre-up /usr/sbin/xsupplicant >/dev/null
        pre-up iwconfig wlan0 key open *
        pre-up iwconfig wlan0 essid host.com
        post-down rmmod ndiswrapper
#       post-down rmmod acx-pci
        post-down /etc/init.d/xsupplicant stop


Reply to: