Set network settings on bootForum: Other Help Topics Topic: Set network settings on boot started by: friedgold Posted by friedgold on May 05 2005,13:14
I thought it would be handy to set your network settings at boot via a cheatcode. This is mainly for people with no dhcp server. To do this I edited /etc/init.d/knoppix-autoconifg as followsfind the section starting
and change it to
I then remastered as normal You can then use the cheatcode eth0=ip,nm,dg,dns where ip is your IP address, nm your netmask, dg your default gateway and dns your dns server. Only the ip address is required, the rest is optional (i.e. you can use eth0=192.168.1.100 to get you network up, although without a gateway/dns server you won't be able to get on the internet). In theory if you have more than one network card you can use eth0=... eth1=... etc to set each one up. Posted by cbagger01 on May 05 2005,21:19
This is a good idea.I assume that it works as designed. Posted by friedgold on May 06 2005,20:12
Well it works fine for me. Im sure it could be improved/tidied up though. Does any one know how the best way to check if a string is a valid ip address? [ -z "$(echo "$i" | awk '/^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/')" ] should check the string is in the form ###.###.###.### where the #'s are nos, but it doesn't rule out stuff like 999.999.999.999. Posted by cbagger01 on May 07 2005,03:18
In my world (rough, minimally functional script creator), if you don't follow directions and you type in stuff incorrectly, then you deserve to get the unpredictable results that are a consequence of your actions.I guess this is what separates me from real programmers who take into account the moron factor. I think that the new feature is good enough as-is, even if you don't do any idiot-proof error checking. But error checking is cool too, if you know how to do it. Posted by Fallen Kell on May 27 2005,18:57
hmmm... trying to figure out what I did wrong. It didn't detect my network device and as such didn't do any of the setup by reading the info from the line.
Posted by clacker on May 28 2005,00:28
Here is a neat way I saw using the cut command to parse out the string:
Posted by Fallen Kell on May 31 2005,15:02
Hey, I found my problem, well most of it anyway. This is really nice, since I have to find a way to get this to work with a frugal install and need network to come up automatically.I will probably do some tweaking, but it looks good. Thanks for doing most of the hard work. |