PDA

View Full Version : Reboot changes Static IP



Zedd_Prophecy
01-05-2006, 01:56 AM
Hi everyone - I just found Knoppix and already am a big fan - I gotta say everything works nicely except for one odd behavior maybe someone might help me with.
I'm not a total noob but I'm no kernel recompiler either.

I have a Knoppix CD booting with a usb drive holding my settings (250 meg ext2 fs)

everything behaves exactly as expected except after a reboot - my static ip is set to 192.168.0.233 and when the system comes back up I dont reconnect ... upon typing ifconfig I see the ip address has changed - its still in the range where it should work but I'm assuming the gateway has changed too as dns no longer resolves.

I can run the network card config and it defaults to all the settings that were previously set ( So I know it remembers my settings - ) and when I accept the defaults (prefilled) I can get online and everything is fine.

I'd almost think it was wanting to go DHCP on me by default no matter what the static settings were ...... ?

I spose I could deal with it but if anyone has anyone has any thoughts I'd be interested.

Thanks,
Rob

Zedd_Prophecy
01-05-2006, 05:24 PM
I also tried the cheatcode nodhcp on boot - that did something different - it changed my ip to local loopack.

??

Mort
01-06-2006, 09:56 PM
Howdy from Tucson,

I have a similler problem. The Knoppix restore seems to save my wireless lan settings but doesn't load them at boot up.
I have to load my wireless card with the ndiswapper, then configue wlan0. All this amounts too is clicking on the
screen to pick the driver file in ndiswapper, then starting wavlan and accepting all the settings stored from
my previous configuration. Including the static IP address I set.

So, surely it should be possible to write a script to load these stettings?

Can someone point us in the right direction. I suspect a shell script like the old config.sys or autoexec.bat.

Where does Knoppix look on boot up for such a configuration file?

Mort

r3dlp
01-08-2006, 11:51 PM
ZP and Mort, although both of your problems share some similarities (you'd like to configure your network card with a static IP, and you'd like to automate this setup), your problems also differ somewhat.

ZP, athough you didn't mention in either of your posts, I suspect that your network card connects directly with your broadband modem or a router connected to your broadband modem. If the prior case is true, then you're going to have to stick with DHCP, and your problem becomes either a routing and/or DNS issue. However, if the later case is true, then you can choose whether you wish to stick with DHCP or use a static IP instead. Nevertheless, your problem still will become a routing and/or DNS issue.

Here's a way to check on your routing setup: netstat -nr. You should get something like this:
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
If you do get something back like this, then your routing should be ok--assuming that your network card is configured with an IP address like 192.168.0.X (where X is [2,254]). The third line contains the route for your particular network segment; assuming that it's correct, then you should be able to ping the IP of your gateway (192.168.0.1 in this case). The fourth line is the default route; this is the route that will handle packets from/to the Internet (or any other network segment besides the one(s) specified in your routing table). On the other hand, if you don't get back some output like that, then you'll need to remove the bogus route(s) from your routing table, and add the correct route(s). You can do that with the route command, like this: route add -net 192.168.0.0 netmask 255.255.255.0 eth0.

Afterwards, you need to check your DNS settings. Edit /etc/resolv.conf. Make sure that it contains the IP(s) of the correct DNS server(s).

You should be able to connect to the Internet just fine by now--assuming that you either not using a firewall, or are using a properly configured firewall. :)

Mort, you asked how to automate the process. Well, fortunately (or perhaps unfortunately to you) there are lots of ways to do this, and I'm not going to get into all of that. You can check out the Linux networking How-To for that. One way to automate the process is to add/adjust an entry in one of your rc scripts--like /etc/rc.conf. This is usually enough to get things up and running for a simple network setup.

FYI: I've been using Linux for . . . ever (since 1992), and I've worked with lots of different distros. I'm tired of tweaking various distro-specific initialization scripts (most of them are in /etc, /etc/network, and/or /etc/init.d) to handle setting up my network. Well, I tweak those scripts for my clients if they ask me to do it, but I came up with another solution for my own setup. I rolled my own network setup script that I can either run manually or add to my bootstrap process. Basically, all you need to do is: make a list of the commands you execute to configure your network, turn that list into a script, test that script (to ensure that it works), and then run chkconfig on it (if you have it on your system). If you don't have chkconfig, then you can manually copy your script to /etc/init.d, and create the appropriate symbolic links to that file (something like, ln -s /etc/init.d/myScript /etc/rc3.d/SXXmyScript). Nevertheless, I'd strongly recommend that you'd check out the initialization scripts infomation from Linux From Scratch project for some interesting ideas on how to tweak your network script(s) further, before attempting this part on your own.

Mort
01-09-2006, 08:32 PM
Thanks for the help.
I'll dig into automating the ndiswapper load with a script.
Getting the wirless running seamlessly is a big step in making Knoppix a daily driver.
I'm even getting tired of entering my wep key every time I want to connect. If I was running
WAP I'd give up. The WAP string is just to time consuming to enter every time and I can never
remember the whole thing.

Thanks again

Mort