Hello Richard,
I had a similar issue. Typically, my notebook is connected to a dhcp network
and when I am travelling, like on the train or plane, I do not want to use
dhcp because it has to time out and the configuration will fail. When I am
travelling, I just set the network connection to a fixed ethernet address.
To solve the problem, I have written a startup script called netconfig, which
I put in /etc/init.d. The script uses an environment variable; NetConfig,
and files called, net-DEFAULT, and net-<config>, located in /etc/conf.d. The
files are copies of net modified for different configurations, i.e. a DHCP
configuration and a fixed IP configuration.
To get the script to work, I have installed it using "rc-update add netconfig
boot"...
The NetConfig environment variable is set via my grub.conf by adding something
like NetConfig=DHCP to the end of the kernel line. Now, my grub
configuration has multiple configurations...
I hope this makes sense. I have included several of my files as examples.
Let me know if you have any questions...
Sean
On July 6, 2003 09:58 pm, Richard Ketchersid wrote:
> I have a laptop and when at home I am attached to the
> web via dsl (eth0). When I use the machine elsewhere I
> am not connected to the internet so the startup file
> /etc/init.d/net.eth0 fails. This causes all sorts of
> other failures due to dependencies. In particular sshd
> will not start. I have errased the lines
>
> depend(){
> use logger dns
> need net
> }
>
> from the sshd startup script. This doesn't help.
> /etc/init.d/sshd start still yields "starting eth0"
> ... which fails and thus sshd fails. There must be an
> easy fix for this. Thanks for any help.
>
> __________________________________
> Do you Yahoo!?
> SBC Yahoo! DSL - Now only $29.95 per month!
> http://sbc.yahoo.com
>
> --
> [EMAIL PROTECTED] mailing list
--
Sean Higgins, [EMAIL PROTECTED]
http://www.systura.com - "Where information meets knowledge."
default 0
timeout 15
splashimage=(hd0,2)/boot/grub/splash.xpm.gz
title=Gentoo DHCP
root=(hd0,2)
kernel= (hd0,2)/boot/bzImage root=/dev/hda5 NetConfig=DHCP
title=Gentoo NoNetwork
root=(hd0,2)
kernel= (hd0,2)/boot/bzImage root=/dev/hda5 NetConfig=NONET
title=Win XP
root=(hd0,0)
chainloader (hd0,0)+1
#!/sbin/runscript
#
# netconfig
#
# Written by: Sean C. Higgins
#
depend() {
before net.*
}
start() {
ebegin "Starting netconfig"
if [ -z "$NetConfig" ]
then
ebegin " Default configuration"
ln -f /etc/conf.d/net-DEFAULT /etc/conf.d/net
else
ebegin " Switching to: $NetConfig"
if [ -f /etc/conf.d/net-$NetConfig ]
then
ln -f /etc/conf.d/net-$NetConfig /etc/conf.d/net || return 1
else
ln -f /etc/conf.d/net-DEFAULT /etc/conf.d/net || return 1
fi
fi
eend $? "File not found - /etc/conf.d/net-$NetConfig"
}
stop() {
ebegin "Stopping netconfig"
rm /etc/conf.d/net || return 1
eend $? "Error removing /etc/conf.d/net"
}
# /etc/conf.d/net:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18
19:39:22 azarah Exp $
# Global config file for net.* rc-scripts
# This is basically the ifconfig argument without the ifconfig $iface
#
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"
# For DHCP set iface_eth? to "dhcp"
# For passing options to dhcpcd use dhcpcd_eth?
#
#iface_eth0="dhcp"
#dhcpcd_eth0="..."
# For adding aliases to a interface
#
#alias_eth0="192.168.0.3 192.168.0.4"
# NB: The next is only used for aliases.
#
# To add a custom netmask/broadcast address to created aliases,
# uncomment and change accordingly. Leave commented to assign
# defaults for that interface.
#
#broadcast_eth0="192.168.0.255 192.168.0.255"
#netmask_eth0="255.255.255.0 255.255.255.0"
# For setting the default gateway
#
#gateway="eth0/192.168.0.1"
# /etc/conf.d/net:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18
19:39:22 azarah Exp $
# Global config file for net.* rc-scripts
# This is basically the ifconfig argument without the ifconfig $iface
#
#iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"
# For DHCP set iface_eth? to "dhcp"
# For passing options to dhcpcd use dhcpcd_eth?
#
iface_eth0="dhcp"
#dhcpcd_eth0="..."
# For adding aliases to a interface
#
#alias_eth0="192.168.0.3 192.168.0.4"
# NB: The next is only used for aliases.
#
# To add a custom netmask/broadcast address to created aliases,
# uncomment and change accordingly. Leave commented to assign
# defaults for that interface.
#
#broadcast_eth0="192.168.0.255 192.168.0.255"
#netmask_eth0="255.255.255.0 255.255.255.0"
# For setting the default gateway
#
#gateway="eth0/192.168.0.1"
# /etc/conf.d/net:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18
19:39:22 azarah Exp $
# Global config file for net.* rc-scripts
# This is basically the ifconfig argument without the ifconfig $iface
#
#iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
#iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0"
# For DHCP set iface_eth? to "dhcp"
# For passing options to dhcpcd use dhcpcd_eth?
#
iface_eth0="dhcp"
#dhcpcd_eth0="..."
# For adding aliases to a interface
#
#alias_eth0="192.168.0.3 192.168.0.4"
# NB: The next is only used for aliases.
#
# To add a custom netmask/broadcast address to created aliases,
# uncomment and change accordingly. Leave commented to assign
# defaults for that interface.
#
#broadcast_eth0="192.168.0.255 192.168.0.255"
#netmask_eth0="255.255.255.0 255.255.255.0"
# For setting the default gateway
#
#gateway="eth0/192.168.0.1"
--
[EMAIL PROTECTED] mailing list