LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 02-19-2013, 04:07 AM   #1
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,168

Rep: Reputation: 48
Having internet with USE_DHCP="" in rc.inet1.conf possible?


Hi: If I want to have static local IP address but my ISP only provides me DHCP, is that possible? To make the local hosts IPs static, I have to have

IPADDR[0]="192.168.0.2" #Example
NETMASK[0]="255.255.255.0"

in /etc/rc.d/rc.inet1.conf

But then I must have
USE_DHCP[0]=""

and then I am left without internet. Is this dilemma solvable?
 
Old 02-19-2013, 04:19 AM   #2
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad T61 6457-4XG
Posts: 4,383

Rep: Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088
If I am correct, this is possible *only* if your ISP provides you a fixed IP address (IOW when you request an IP address, the DHCP server of your ISP always gives you the same one).

Then you can just use the "static IP" option of 'netconfig' to set up your wired network connection.

I assume the NetworkManager option is usable as well for that, but didn't actually check.
 
Old 02-19-2013, 04:39 AM   #3
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,168

Original Poster
Rep: Reputation: 48
Thanks. My ISP only gives dynamic IPs. But there must be a way I can choose an IP for the machines in my LAN. For the moment, what I do is to run ifconfig and use the IP appearing to the right of inet. Example:
# ifconfig
eth0 inet 192.168.0.100

and I use 192.168.0.100 for that machine. But then, may be tomorrow, I run ifconfig and the inet number has change, which is very upsetting. Is there a solution?
 
Old 02-19-2013, 04:51 AM   #4
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 755

Rep: Reputation: 226Reputation: 226Reputation: 226
If you try putting the following in a file under /lib/dhcpcd/dhcpcd-hooks/

Code:
ip addr add 192.168.0.100/24 eth0
That might be persistent.

There are examples for other distros but they have totally different network configuration systems so I don't know how to convert them over.
 
Old 02-19-2013, 04:54 AM   #5
Didier Spaier
Senior Member
 
Registered: Nov 2008
Location: Paris, France
Distribution: Slackware{,64}-{14.1,current} on a Lenovo Thinkpad T61 6457-4XG
Posts: 4,383

Rep: Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088Reputation: 1088
Does one of your boxes act as a NAT router, or are they all directly connected to the Internet ?
 
Old 02-19-2013, 04:59 AM   #6
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,168

Original Poster
Rep: Reputation: 48
The two computers in my LAN are connected to a NAT router and this to the cable modem.
 
Old 02-19-2013, 05:02 AM   #7
wildwizard
Member
 
Registered: Apr 2009
Location: Oz
Distribution: slackware64-14.0
Posts: 755

Rep: Reputation: 226Reputation: 226Reputation: 226
Hmm.

Did you set a default route (Shown as "GATEWAY" in rc.inet1.conf) when you tired the static only settings?
 
Old 02-19-2013, 05:05 AM   #8
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,168

Original Poster
Rep: Reputation: 48
Yes, I put

GATEWAY="192.168.0.1"

which was in the output of the route command.
 
Old 02-19-2013, 05:07 AM   #9
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,464

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
Following from my suggestion in your thread, the answer is YES.

You do not need to use any Windows setup software. You can access your router and do configuration using a web browser on your Slackware box.
Again, from the manual
Quote:
1.
To access the configuration utility, open a web-browser and type the default address
http://tplinklogin.net in the address field of the browser.
After a moment, a login window will appear, similar to the Figure 3-4. Enter admin for the User
Name and Password, both in lower case letters. Then click the OK button or press the Enter key.
Once you have accesss to the router, you can do the address reservation according to the manual section 4.7.3
When this is completed, your Slackware box will always be assigned the same IP address. The behaviour will be exactly like assigning a static IP address to your Slackware box. I do this with my setup, so that my desktop, laptop wired interface and laptop wireless interface are always assigned the same IP address. This is necessary for me to be able to use NFS without addressing issues.

I think you need to understand the steps involved in establishing your connection to the internet. When you turn your router on, it sends out a DHCP request to your ISP's DHCP server and the ISP's server responds and assigns your router a WAN IP address. As you have seen, this is likely to be different from one connection to the next. This is the IP address that would be reported if you were to do a query to whatsmyip or similar.
Your router also contains a DHCP server (enabled by default with your hardware). If you have your Slackware box set to use DHCP, it will send a DHCP request that will go to your router's DHCP server. The router's DHCP server will respond and assign your SLackware box a LAN IP address.
By using address reservation, this will always be the same IP address.

Last edited by allend; 02-19-2013 at 05:10 AM.
 
Old 02-19-2013, 05:24 AM   #10
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,168

Original Poster
Rep: Reputation: 48
You are the first person who explains this with clarity. It's now a week long since I began reading the Linux Network Administrator's Guide, only to find, just now, that is does not mention DHCP anywhere. I've lost my time. Now I am reading http://www.tldp.org/HOWTO/Cable-Modem/index.html but I'm afraid the part covering DHCP is inaccessible.

What I can't understand is that my problem has to be a very common one for people having two computers connected to the same ISP account. Why pay for two accounts?
 
Old 02-19-2013, 05:34 AM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Main: Gentoo Others: What fits the task
Posts: 15,592
Blog Entries: 2

Rep: Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047Reputation: 4047
You don't pay for two accounts. Your problem is a problem in understanding, it is neither a physical nor a hardware problem, so for most people it is not a common problem. From reading your threads I get the feeling that you tend to over-complicate simple things, preventing yourself from seeing the simple solutions. I will explain it once more here, as I have done in your other thread regarding the same topic (in the future please ask follow up questions in the already existing thread).

Your router and the PCs in your local net are totally independent from your modem and the Internet. While your modem gets an IP from your ISP (via DHCP) this has absolutely nothing to do with DHCP in your local network. Again, those networks are independent, your local machines don't care at all (and don't need to know) how the modem gets its IP.
Just give them a static IP, set the router as gateway and all is fine.
 
Old 02-19-2013, 05:43 AM   #12
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,464

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
Quote:
Just give them a static IP, set the router as gateway and all is fine.
I do not recommend doing this. Setting up DHCP correctly will pay dividends in the future. It will make adding additional devices to your LAN much easier.
 
Old 02-19-2013, 05:43 AM   #13
stf92
Senior Member
 
Registered: Apr 2007
Location: Buenos Aires.
Distribution: Slackware
Posts: 3,168

Original Poster
Rep: Reputation: 48
OK. But I repeat once more. If I put USE_DHCP="" I am left without internet. Are the settings in inet1.conf LAN settings or WAN settings?
 
Old 02-19-2013, 05:48 AM   #14
allend
Senior Member
 
Registered: Oct 2003
Location: Melbourne
Distribution: Slackware-current
Posts: 3,464

Rep: Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852Reputation: 852
To use DHCP you want USE_DHCP="yes"

The settings in rc.inet1.conf are LAN settings in your setup.

Last edited by allend; 02-19-2013 at 05:49 AM.
 
Old 02-19-2013, 05:59 AM   #15
414N
Member
 
Registered: Sep 2011
Location: Italy
Distribution: Slackware
Posts: 609

Rep: Reputation: 180Reputation: 180
Quote:
Originally Posted by stf92 View Post
OK. But I repeat once more. If I put USE_DHCP="" I am left without internet. Are the settings in inet1.conf LAN settings or WAN settings?
Disabling DHCP, you also need to set up the gateway (as you already did) AND the name server in /etc/resolv.conf, like this:
Code:
nameserver 192.168.0.1
otherwise you won't be able to resolve remote host names.
 
  


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
"domain-name" and "host-name" options in dhcpd.conf m4rtin Linux - Server 3 09-20-2012 08:21 AM
xorg.conf : Explanation of "Viewport" and "Virtual" uncle-c Linux - Newbie 1 01-24-2011 11:04 AM
Error for wireless request "Set Nickname" (8B1C) -- /etc/rc.d/rc.inet1.conf hellbillyJoker Linux - Networking 1 04-06-2010 07:24 PM
Problems configuring "xorg.conf" with "ATI FGLRX" BlueSpirit Slackware 3 09-16-2006 02:01 PM
error "Set Frequency" (8b04) : when restarting rc.inet1 tux31337 Linux - Wireless Networking 1 02-13-2006 03:47 PM


All times are GMT -5. The time now is 01:40 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration