LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-31-2008, 03:04 AM   #1
farmerdave
Member
 
Registered: Mar 2008
Location: Adelaide, Australia
Distribution: Arch, Slackware 13.37
Posts: 101
Blog Entries: 1

Rep: Reputation: 16
static ip connection fails upon reboot


I am configuring my internet connection in /etc/rc.d/rc.inet1.conf as follows:

# Config information for eth0:
IPADDR[0]="192.168.1.103"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]="yes"
DHCP_HOSTNAME[0]=""

# Default gateway IP address:
GATEWAY="192.168.1.1"

These settings work fine. If i modify this to use the static ip by changing to
USE_DHCP[0]=" "

and then type

sudo /etc/rc.d/rc.inet1 restart I have no problems, connection resets and works fine and ifconfig outputs that i am indeed using the new ip address.

If i reboot my computer, the connection fails and the only way to reconnect is to change back to USE_DHCP[0]="yes" and restart. I cannot figure what is going wrong, thoughts would be appreciated.
 
Old 10-31-2008, 03:15 AM   #2
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Look at the network setup script in /etc/rc.d/init.d to see how it processes the config file.
Maybe it doesn't like a blank or space as the value for USE_DHCP and you should use "no" instead (or "qwijibo" if you're daring).
 
Old 10-31-2008, 03:51 AM   #3
farmerdave
Member
 
Registered: Mar 2008
Location: Adelaide, Australia
Distribution: Arch, Slackware 13.37
Posts: 101
Blog Entries: 1

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by pinniped View Post
Look at the network setup script in /etc/rc.d/init.d to see how it processes the config file.
Maybe it doesn't like a blank or space as the value for USE_DHCP and you should use "no" instead (or "qwijibo" if you're daring).
I'm not sure which script to looks at, in that folder i have two files;

functions and
README.functions

I get a little lost when i try and understand the content of the files!

I don't think the blank space is affecting it, neither one seems to work when initially booting into it, but both work fine if i boot using the dhcp setting and then setting to static and running the "/etc/rc.d/rc.inet1 restart" command.
 
Old 10-31-2008, 08:34 AM   #4
richwmn
LQ Newbie
 
Registered: Dec 2005
Location: Athens, GA
Distribution: Slackware (various),Ubuntu 9.04
Posts: 27

Rep: Reputation: 17
Quote:
Originally Posted by pinniped View Post
Look at the network setup script in /etc/rc.d/init.d to see how it processes the config file.
Maybe it doesn't like a blank or space as the value for USE_DHCP and you should use "no" instead (or "qwijibo" if you're daring).
In slackware the proper file to look at is /etc/rc.d/rc.inet1
A couple of questions -
When you first installed the system, how did you answer the ip address question static or dhcp?
Did you modify any other script?
What are you using as your dhcp server, most likely your router -- if so make and model.

I tried to duplicate your problem with the following results -
1 - dhcp = "yes" - address provided by dhcp server
2 - dhcp = "" - address specified
3 - dhcp - "no" - address specified
(all with slackware 12.1)


Rich
 
Old 11-01-2008, 03:11 AM   #5
farmerdave
Member
 
Registered: Mar 2008
Location: Adelaide, Australia
Distribution: Arch, Slackware 13.37
Posts: 101
Blog Entries: 1

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by richwmn View Post
In slackware the proper file to look at is /etc/rc.d/rc.inet1
A couple of questions -
When you first installed the system, how did you answer the ip address question static or dhcp?
I answered dhcp
Quote:
Originally Posted by richwmn View Post
Did you modify any other script?
No.
Quote:
Originally Posted by richwmn View Post
What are you using as your dhcp server, most likely your router -- if so make and model.
Linksys WRT54GL wireless router connected to a Motorola SB5101 cable modem.
 
Old 11-01-2008, 03:50 AM   #6
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Quote:
Originally Posted by farmerdave View Post
Linksys WRT54GL wireless router connected to a Motorola SB5101 cable modem.
Are you connecting to that router via a wire or via a wireless card?
 
Old 11-01-2008, 04:13 AM   #7
farmerdave
Member
 
Registered: Mar 2008
Location: Adelaide, Australia
Distribution: Arch, Slackware 13.37
Posts: 101
Blog Entries: 1

Original Poster
Rep: Reputation: 16
Via an ethernet cable.
 
Old 11-01-2008, 04:25 AM   #8
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
OK, first of all let's establish what's gone wrong with the networking - is it a misconfiguration of the IP address, nameserver, gateway, or what-not.

When you reboot (hoping to use the static IP), does 'ifconfig' tell you it's not configured at all, or does it tell you that it *is* configured with the IP address you want?

Your gateway and netmask look fine to me, so I'll assume you have no problem with that. Can you ping the router?

ping 192.168.1.1

If you can ping the router then the problem would be with name resolution - something like this should ultimately fail:

hostname www.google.com
(sometimes 'hostname' doesn't exist and instead you have the deprecated name 'nslookup')

In the case of a name resolution failure, this is probably a simple matter of incorrect network setup. The best method would be to *always* use DHCP but configure the router to give you a static IP. To assign a static IP, you need the MAC string:

ifconfig eth0

eth0 Link encap:Ethernet HWaddr 00:e0:81:2f:09:cb

So in my case the MAC is "00:e0:81:2f:09:cb"
 
Old 11-01-2008, 05:23 AM   #9
farmerdave
Member
 
Registered: Mar 2008
Location: Adelaide, Australia
Distribution: Arch, Slackware 13.37
Posts: 101
Blog Entries: 1

Original Poster
Rep: Reputation: 16
When i reboot, ifconfig says it is configured using the ip address i want. I can also ping the router, and like you said, the name resolution fails. I'll try setting the router to assign the 'static' ip.
 
Old 11-01-2008, 05:28 AM   #10
pinniped
Senior Member
 
Registered: May 2008
Location: planet earth
Distribution: Debian
Posts: 1,732

Rep: Reputation: 50
Setting the router to give a static IP via DHCP is the best thing to do. The alternative is to edit /etc/resolv.conf to include nameservers. If the router handles the name resolution then all you need in resolv.conf is something like:

nameserver 192.168.1.1

But with DHCP the gateway and DNS servers are automatically set up.
 
Old 11-02-2008, 02:57 AM   #11
farmerdave
Member
 
Registered: Mar 2008
Location: Adelaide, Australia
Distribution: Arch, Slackware 13.37
Posts: 101
Blog Entries: 1

Original Poster
Rep: Reputation: 16
Thankyou pinniped, I believe you have solved it!

I knew that i had to modify /etc/resolv.conf and i had checked it when i had the settings on dhcp to see what i should set it on. After rebooting with the intention of using a static ip, this file has only my domain name, not the name servers. adding the nameservers gives me a working internet connection immediately.

Thanks!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
static arp entry - how to survive reboot awreneau Linux - Server 5 12-12-2007 05:27 PM
Samba: fails with static ip. No prob dynamic TotalLinuxNoob Linux - Networking 2 03-03-2007 02:42 PM
Mandriva 10.1 fails to reboot and shows "No reboot fixup found for your hardware" ROY913 Mandriva 1 12-12-2005 03:10 AM
DHCP fails, static IP partially works bigRez Linux - Networking 1 04-20-2004 07:23 PM
grep-2.5 static fails ca9mbu Linux From Scratch 1 06-09-2002 11:50 AM


All times are GMT -5. The time now is 06:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration