Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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).
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.
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)
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
Did you modify any other script?
No.
Quote:
Originally Posted by richwmn
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.
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:
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.