How to configure PC for wired/static and wired/DHCP networks?
Tapas Mishra
mightydreams at gmail.com
Wed Oct 27 15:57:55 UTC 2010
On Wed, Oct 27, 2010 at 6:41 PM, Tom H <tomh0665 at gmail.com> wrote:
>
> If this is in different locations rather than simultaneous, ifupdown
> provides ping-places.sh to be used in "/etc/network/interfaces" to
> determine which configuration to use.
Thanks yes Different places/networks, not simultaneous.
I prefer to identify the LAN by the MAC address of the default
gateway because there are so many 192.168.0.0 and 192.168.1.0 networks
and "always up" systems on a LAN are not always up (!) and can change
address whereas the default gateway is more likely to be up and its
MAC address is less likely to change. It's not a very robust solution
but I don't know of anything better and it has been "good enough" for
a while.
Design-wise, I was thinking along the lines of parallel processes to:
Bring up eth0 as a DHCP interface.
For each known static network: bring up eth0:x configured with static
values and try to get the default gateway's MAC address to identify
the network.
Wait with a reasonable time to see if DHCP configures eth0 (abandon if
the network is identified by any of the step 2 processes) and, if it
does, identify the appropriate by the default gateway's MAC address.
Remove useless/unwanted interfaces including the DHCP one even if it
got a lease if it's for a network we have static settings for.
At this point the network is identified as known or unknown and the
script can, as appropriate, configure routing; configure DNS
resolution; mount networked file systems; start services such as cups,
NFS, samba, sshd ... .
More information about the ubuntu-users
mailing list