LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Having internet with USE_DHCP="" in rc.inet1.conf possible? (https://www.linuxquestions.org/questions/slackware-14/having-internet-with-use_dhcp%3D-in-rc-inet1-conf-possible-4175450762/)

stf92 02-19-2013 04:07 AM

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?

Didier Spaier 02-19-2013 04:19 AM

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.

stf92 02-19-2013 04:39 AM

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?

wildwizard 02-19-2013 04:51 AM

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.

Didier Spaier 02-19-2013 04:54 AM

Does one of your boxes act as a NAT router, or are they all directly connected to the Internet ?

stf92 02-19-2013 04:59 AM

The two computers in my LAN are connected to a NAT router and this to the cable modem.

wildwizard 02-19-2013 05:02 AM

Hmm.

Did you set a default route (Shown as "GATEWAY" in rc.inet1.conf) when you tired the static only settings?

stf92 02-19-2013 05:05 AM

Yes, I put

GATEWAY="192.168.0.1"

which was in the output of the route command.

allend 02-19-2013 05:07 AM

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.

stf92 02-19-2013 05:24 AM

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?

TobiSGD 02-19-2013 05:34 AM

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.

allend 02-19-2013 05:43 AM

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.

stf92 02-19-2013 05:43 AM

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?

allend 02-19-2013 05:48 AM

To use DHCP you want USE_DHCP="yes"

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

414N 02-19-2013 05:59 AM

Quote:

Originally Posted by stf92 (Post 4895019)
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.

stf92 02-19-2013 06:03 AM

I'll try first doing it the simple way, as TobiSGD says and, if I succeed, I will then do it as allend says (1). So, if I understood well, I must do

IPADDR[0]="192.168.0.2" #Example
NETMASK[0]="255.255.255.0"
USE_DHCP[0]="yes"
GATEWAY="<the IP the modem gets from the ISP>

However, I've already done this and it did not work, but I'll do it again. That is, I will have internet, but the IP of this machine won't be 192.168.0.2.

By the way, what do you mean "set the router as gateway", TobiSGS? Anything to do with GATEWAY=?

(1) If I don't, I'll follow allend anyways.

414N 02-19-2013 06:12 AM

If all you want is a static IP on your machine while being able to access the internet through your modem, you only need to set up 3 things manually while disabling DHCP:
  1. the desired IP/netmask combination;
  2. the gateway, that must point to the modem local IP (not the WAN IP assigned by the ISP) e.g. 192.168.0.1;
  3. the DNS, that can be set to the modem local IP too to use the DNS configured on the modem
While the first two settings can be set in the /etc/rc.d/rc.inet1.conf file, the last one needs an appropriate "nameserver [IP]" entry in the /etc/resolv.conf file.
Keep in mind that if you switch again to using DHCP without telling it to keep the resolv.conf file as-is, it will be overwritten.

allend 02-19-2013 06:14 AM

Now you are finding out why DHCP will ultimately be better and easier. DHCP handles the gateway, network mask and name resolution stuff automatically.
The gateway address is the LAN IP address of your router, probably 192.168.0.1

TobiSGD 02-19-2013 06:20 AM

Quote:

Originally Posted by stf92 (Post 4895029)
So, if I understood well, I must do

IPADDR[0]="192.168.0.2" #Example
NETMASK[0]="255.255.255.0"
USE_DHCP[0]="yes"
GATEWAY="<the IP the modem gets from the ISP>

No, as several times pointed out already, you do not use DHCP and static IPs on the same machine at the same time. And you do not set the gateway IP to the IP the the modem gets from your ISP. This IP is on the side of your network that face the Internet, not your local net.

See this example:
Code:

PC1 (IP: 192.168.0.100)--
                        |
                        --- Router (IP: 192.168.0.1 on local net, set by DHCP on the Internet side by the modem) --- Modem (IP: DHCP from ISP)
                        |
PC2 (IP: 192.168.0.101)--

In this example you would set the gateway address on both PCs to 192.168.0.1, the address of the router that is facing towards you local network. The Other IP addresses are irrelevant for you.

Quote:

Originally Posted by allend
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.

Quote:

Now you are finding out why DHCP will ultimately be better and easier. DHCP handles the gateway, network mask and name resolution stuff automatically.
Easier in larger networks, yes, I agree. In small (home) networks the approach with static IPs is much easier, especially if the machines should communicate with each other. Of course you can go for a mixed approach (I do that on my network), where machines that are always there get a static IP, but the router is still offering DHCP for temporary connections and machines that don't have to communicate with each other in a simple way.

273 02-19-2013 06:22 AM

I'm in agreement with allend here, as I mentioned in the other thread. Leave the machines as DHCP and use the simple web interface of your router to give them static IP addresses.
There's just a small thing that's not quite clicking that's making this seem a lot more complicated than it is.
This looks like it might describe what's going on:
http://networking.nitecruzr.net/2005...at-router.html
You could also google "NAT Router" but some of the explanations are long-winded and take in more cases than the simple home network.

tronayne 02-19-2013 07:00 AM

I use a setup similar, I think, to what you're trying to do; maybe this will help (and, well, maybe not but here goes).

I've had DSL and now satellite service. The ISP provides a modem or modem/router that typically is DHCP -- you connect a computer to it (say a Windows machine) and away you go (Windows machines all default to DHCP). Typically, the modem has an address such as 192.168.0.1 or 192.168.1.1; that is you gateway (to the internet) address. The other side of the modem, the Internet side, has the address assigned to you by the ISP server which will vary every time the modem is turned off for a while then turned back on (that's what DHCP does at the ISP end, it "leases" an address to your modem at power up).

On your side of the modem, when you power up a computer, the modem's DHCP assigns an address to your connection, something like 192.168.1.100 (and these addresses can vary, but they'll never be 192.168.0.1 or 192.168.1.1, the gateway address).

Now, you want to connect multiple devices to your Internet connection; computers, printers, TV set-top, whatever, and you want it wired (or maybe wired and wireless, who knows). So, you get yourself, oh, say a 4-port router.

What the router gives you is route for your devices to talk to each other and to the Internet. You can do this with either DHCP or fixed-IP, both of which require a little bit of configuration so everybody knows who they are and who everybody else is (think telephone numbers here, might make it easier).

When you installed Slackware you were questioned about setting up your network; you gave each system a name and a domain (maybe). If you chose DHCP, you were all done; however, if you chose fixed-IP, you were prompted to enter addresses.

Here's the trick: DHCP (in the router) will usually start leasing at 192.168.1.100 (or something like that, it won't start at 192.168.1.2). That means that you can specify the address of each device from 192.168.1.2 through 192.168.1.99 -- pretty neat, huh? And, wonder of wonders, the router will handle that just fine. You don't need to set anything in the router for this to work -- well, you do have enable DHCP in the router if it isn't enabled by default, but you don't have to list server addresses in there.

My in-house systems are fixed-IP (I prefer it that way). When I execute netconfig (the Slackware utility you set up you network with), I give a name, an address, netmaksk, gateway address and a DNS address. Those are saved in /etc/rc.d/rc.inet1.conf and look like this:
Code:

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

# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

# Config information for eth2:
IPADDR[2]=""
NETMASK[2]=""
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""

# Config information for eth3:
IPADDR[3]=""
NETMASK[3]=""
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""

# Default gateway IP address:
GATEWAY="192.168.1.1"

The netconfig utility saves the system name and address in /etc/hosts like this:
Code:

192.168.1.10                fubar.com fubar
(I gave it "fubar" as the name, "com" as the domain and I manually add the alias "fubar" so I don't have to type "fubar.com" to connect to the server from another server).

Simple? Yup. My /etc/hosts file (on every server) looks like
Code:

# For loopbacking.
127.0.0.1                localhost
# Local servers
192.168.1.10                fubar.com fubar
192.168.1.15                InkJet
192.168.1.20                snafu.com snafu
192.168.1.30                pita.com pita
# Public servers
75.126.162.205                www.linuxquestions.org        linuxquestions.org
74.125.224.70                maps.google.com
74.125.224.111                maps.gstatic.com

# End of hosts.

Those "Public Servers" in there? Those are so there is no DNS look up for their addresses, /etc/hosts entries are the first place looked at before DNS is invoked. It's quicker.

Can you do this same thing with DHCP? Of course.

This link, http://www.linuxquestions.org/questi...9/#post4826521, will take you a example of a working DHCP network configuration (with thanks to @kikinovak, a pretty smart guy). As you scan though it you'll see that device names and addresses are assigned and DHCP (in the router) will honor those.

The important thing is that devices configured with fixed-IP or DCHP (as described) can find each other (so you can do stuff like use scp between them without fooling around).

Now, you can plug a Windows box into your router and it'll work (to the Internet anyway) because the router will give it a lease at 192.168.1.100 or so and that will not interfere with your configured device addresses. Pretty slick.

Hope this helps some.

stf92 02-19-2013 07:34 AM

Quote:

Originally Posted by 414N (Post 4895033)
If all you want is a static IP on your machine while being able to access the internet through your modem, you only need to set up 3 things manually while disabling DHCP:
  1. the desired IP/netmask combination;
  2. the gateway, that must point to the modem local IP (not the WAN IP assigned by the ISP) e.g. 192.168.0.1;
  3. the DNS, that can be set to the modem local IP too to use the DNS configured on the modem
While the first two settings can be set in the /etc/rc.d/rc.inet1.conf file, the last one needs an appropriate "nameserver [IP]" entry in the /etc/resolv.conf file.
Keep in mind that if you switch again to using DHCP without telling it to keep the resolv.conf file as-is, it will be overwritten.

I did the three things in both machines, plus the /etc/hosts thing, and the result was: (a) I have internet in both machines. (b) I can slogin from machine A into machine B. (c) I CANNOT slogin from B into A. When I try I get:
Code:

ssh: connect to host SERVER_HOST port 22: no route to host.
However, while in B ifconfig gives inet=192.168.0.3, which is fine, in B it gives inet=192.168.0.100 I can't understand why. I should be inet=192.168.0.2.

EDIT: thank you tronayne for your kind advices.

tronayne 02-19-2013 07:54 AM

If you're using static addresses, fixed-IP, add all devices to the /etc/hosts file on all machines, then they can find each other.

Oh, yeah, when you change network settings it's a good idea to reboot the machine you changed 'em on (if you didn't already do that). You don't need to reboot any others.

stf92 02-19-2013 08:15 AM

Quote:

Originally Posted by tronayne (Post 4895096)
If you're using static addresses, fixed-IP, add all devices to the /etc/hosts file on all machines, then they can find each other.

Yes, I did that. I also reset the modem, the router and the machines several times: no use. I in A I do

ifconfig eth0 192.168.0.2

then all is fine. But when I reboot, I am again 192.168.0.100!

tronayne 02-19-2013 08:27 AM

On that box run netconfig. Give it name, domain, netmask (the default ought to OK), address is 192.168.0.2, gateway is 192.168.0.1, DNS, oh, 8.8.8.8 (that's Google's DNS server). Review the settings on the page that pops up and exit netconfig.

netconf wipes out /etc/hosts, so edit in the other machine(s) names and addresses.

Reboot.

Ought to do it.

273 02-19-2013 08:30 AM

Quote:

Originally Posted by TobiSGD (Post 4895037)
Easier in larger networks, yes, I agree. In small (home) networks the approach with static IPs is much easier, especially if the machines should communicate with each other. Of course you can go for a mixed approach (I do that on my network), where machines that are always there get a static IP, but the router is still offering DHCP for temporary connections and machines that don't have to communicate with each other in a simple way.

DHCP on most home routers gives the ability to hand out specific IP addresses to specific machines every time.
This is, I find, quicker to set up than setting a fixed IP on each machine individually and means that if machines are taken from your network and plugged into a new network they'll likely start to work there too. It also leaves the rest of the DHCP range for any new devices you introduce.
Of course host file entries still need adding for other machines on the network but that should be easier to explain one the router settings have been seen.
Personally, that is how I would solve this particular problem. That and some reading of the principals involved.
Perhaps it's just me but using manually configured fixed IP addresses seems a little "old fashioned" and long-winded?

stf92 02-19-2013 08:33 AM

To run netconfig is what I did, but no use. Now, in /etc/resolv.conf I put 192.168.0.1. Should it be 8.8.8.8?

tronayne 02-19-2013 08:50 AM

Most routers that I've fiddled with tend to lose their little minds doing DNS (maybe that's changed, but I dunno) -- for some reason or other they stop serving DNS after a period of time and I find it more useful to simply put entries in /etc/resolv.conf. At least the one's I have do that.

You ISP ought to provide one or two DNS addresses or you can use Google's freebies (8.8.8.8 and 8.8.4.4) and your /etc/resolv.conf ought to look like this:
Code:

cat /etc/resolv.conf
search com
nameserver 68.94.156.1
nameserver 68.94.157.1
# Google Free DNS Servers
#nameserver 8.8.8.8
#nameserver 8.8.4.4
# HughesNet DNS Servers
#nameserver 66.82.4.8
#nameserver 66.82.4.12

The first two are ISP-provided, the others are commented out but available if the first two go away for some reason (and they then will be commented out or deleted).

You only need two; if the first on the list is dead, you'll sit there for quite a while waiting for the timeout to switch to the second (and so on if you have more).

Trick is, ping the addresses and select the one that's the fastest to be first.

stf92 02-19-2013 10:07 AM

Honestly, I don't understand well this DNS subject. One thing I know is that I do not have BINDS activated. Neither dnsmasq. I thought that in /etc/resolv.conf I have to put the IP of the gateway, which is 192.168.0.1 in my case, according to the route command.

On the other hand, I have two workarounds to momentarily solve this problem: One is to put the line

ifconfig eth0 192.168.0.2

in /etc/rc.d/rc.local, so it executes each time the system boots. The other, and the one I chose, given that the ifconfig command insists in tell me that my ip address is 192.168.0.100, is to choose this ip for this machine. Doing this, all works fine. But I do not know why I can't choose an arbitrary ip in the range 192.168.0.0 192.168.0.254.

Didier Spaier 02-19-2013 11:11 AM

Quote:

Originally Posted by stf92 (Post 4895181)
One thing I know is that I do not have BINDS activated. Neither dnsmasq. I thought that in /etc/resolv.conf I have to put the IP of the gateway, which is 192.168.0.1 in my case, according to the route command.

So, if I understand you put in /etc/resolv.conf as nameserver the IP address of your gateway, where there is no nameserver :scratch:

stf92 02-19-2013 11:14 AM

In fact, that is what netconfig did by default.

414N 02-19-2013 11:16 AM

Quote:

Originally Posted by Didier Spaier (Post 4895214)
So, if I understand you put in /etc/resolv.conf as nameserver the IP address of your gateway, where there is no nameserver :scratch:

I do that too in my setup and it works nonetheless, because the modem/router delegates name resolution to my ISP DNSs.

NeoMetal 02-19-2013 11:23 AM

The router probably caches and forwards dns

So from the machine that won't keep the ip address you are attempting to give it, can you post your rc.inet1.conf ?

Didier Spaier 02-19-2013 11:23 AM

Quote:

Originally Posted by stf92 (Post 4895221)
In fact, that is what netconfig did by default.

This is not actually by default. As you told it that you have a gateway and on many local networks there is name server on the gateway, it proposes that to save you some typing, just in case.

Tip: do not accept a proposed setting unless you know it is appropriate in your case.

stf92 02-19-2013 11:27 AM

Quote:

Originally Posted by NeoMetal (Post 4895229)
The router probably caches and forwards dns

So from the machine that won't keep the ip address you are attempting to give it, can you post your rc.inet1.conf ?

Code:

root@SERVER_HOST:~# cat /etc/rc.d/rc.inet1.conf
# /etc/rc.d/rc.inet1.conf
#
# This file contains the configuration settings for network interfaces.
# If USE_DHCP[interface] is set to "yes", this overrides any other settings.
# If you don't have an interface, leave the settings null ("").

# You can configure network interfaces other than eth0,eth1... by setting
# IFNAME[interface] to the interface's name. If IFNAME[interface] is unset
# or empty, it is assumed you're configuring eth<interface>.

# Several other parameters are available, the end of this file contains a
# comprehensive set of examples.

# =============================================================================

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

# Config information for eth1:
IPADDR[1]=""
NETMASK[1]=""
USE_DHCP[1]=""
DHCP_HOSTNAME[1]=""

# Config information for eth2:
IPADDR[2]=""
NETMASK[2]=""
USE_DHCP[2]=""
DHCP_HOSTNAME[2]=""

# Config information for eth3:
IPADDR[3]=""
NETMASK[3]=""
USE_DHCP[3]=""
DHCP_HOSTNAME[3]=""

# Default gateway IP address:
GATEWAY="192.168.0.1"

# Change this to "yes" for debugging output to stdout.  Unfortunately,
# /sbin/hotplug seems to disable stdout so you'll only see debugging output
# when rc.inet1 is called directly.
DEBUG_ETH_UP="no"

# Example of how to configure a bridge:
# Note the added "BRNICS" variable which contains a space-separated list
# of the physical network interfaces you want to add to the bridge.
#IFNAME[0]="br0"
#BRNICS[0]="eth0"
#IPADDR[0]="192.168.0.1"
#NETMASK[0]="255.255.255.0"
#USE_DHCP[0]=""
#DHCP_HOSTNAME[0]=""

## Example config information for wlan0.  Uncomment the lines you need and fill
## in your info.  (You may not need all of these for your wireless network)
#IFNAME[4]="wlan0"
#IPADDR[4]=""
#NETMASK[4]=""
#USE_DHCP[4]="yes"
#DHCP_HOSTNAME[4]="icculus-wireless"
#DHCP_KEEPRESOLV[4]="yes"
#DHCP_KEEPNTP[4]="yes"
#DHCP_KEEPGW[4]="yes"
#DHCP_IPADDR[4]=""
#WLAN_ESSID[4]=BARRIER05
#WLAN_MODE[4]=Managed
##WLAN_RATE[4]="54M auto"
##WLAN_CHANNEL[4]="auto"
##WLAN_KEY[4]="D5AD1F04ACF048EC2D0B1C80C7"
##WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=96389dc66eaf7e6efd5b5523ae43c7925ff4df2f8b7099495192d44a774fda16"
#WLAN_WPA[4]="wpa_supplicant"
#WLAN_WPADRIVER[4]="ndiswrapper"

## Some examples of additional network parameters that you can use.
## Config information for wlan0:
#IFNAME[4]="wlan0"              # Use a different interface name nstead of
                                # the default 'eth4'
#HWADDR[4]="00:01:23:45:67:89"  # Overrule the card's hardware MAC address
#MTU[4]=""                      # The default MTU is 1500, but you might need
                                # 1360 when you use NAT'ed IPSec traffic.
#DHCP_KEEPRESOLV[4]="yes"      # If you dont want /etc/resolv.conf overwritten
#DHCP_KEEPNTP[4]="yes"          # If you don't want ntp.conf overwritten
#DHCP_KEEPGW[4]="yes"          # If you don't want the DHCP server to change
                                # your default gateway
#DHCP_IPADDR[4]=""              # Request a specific IP address from the DHCP
                                # server
#WLAN_ESSID[4]=DARKSTAR        # Here, you can override _any_ parameter
                                # defined in rc.wireless.conf, by prepending
                                # 'WLAN_' to the parameter's name. Useful for
                                # those with multiple wireless interfaces.
#WLAN_IWPRIV[4]="set AuthMode=WPAPSK | set EncrypType=TKIP | set WPAPSK=thekey"
                                # Some drivers require a private ioctl to be
                                # set through the iwpriv command. If more than
                                # one is required, you can place them in the
                                # IWPRIV parameter (separated with the pipe (|)
                                # character, see the example).
root@SERVER_HOST:~#


NeoMetal 02-19-2013 12:57 PM

When you originally configured networking, did you enable network manager?

Try doing 'ls -l /etc/rc.d/rc.networkmanager' and see if the file is executable

Didier Spaier 02-19-2013 01:15 PM

Quote:

Originally Posted by NeoMetal (Post 4895309)
When you originally configured networking, did you enable network manager?

I guess he didn't, otherwise 'netconfig' wouldn't have asked for a gateway and a nameserver.

NeoMetal 02-19-2013 01:36 PM

But he's been trying a few different configurations and might have initially chosen network manager, I am not positive whether doing a second netconfig after having setup network manager actually disables it from running - it very well might, but I haven't tried it so I thought it might be worth checking in case it acts as if its the first time you set up networking each time its run

Didier Spaier 02-19-2013 02:20 PM

I just had a look to 'netconfig' to be sure.

After the configuration is complete and if the user confirms it, the config files are (re)written.

So the new settings override the previous ones. IOW, yes, the script takes care of cleaning the house.

Knowing that it was mostly written by Patrick Volkerding, this is not very surprising ;)

But setting a file in /etc/rc.d executable or not is up to the admin.

NeoMetal 02-19-2013 02:26 PM

Right. So my suggestion is simply to confirm that it is not executable,
in case on his first install he configured with network manager, netconfig would do

if [ "$NETWORKMANAGER" = "yes" -a -r etc/rc.d/rc.networkmanager ]; then
chmod 755 etc/rc.d/rc.networkmanager



And then on second netconfig to change to static ip it might still be +X and trying to grab a dhcp addy

Didier Spaier 02-19-2013 02:36 PM

Quote:

Originally Posted by NeoMetal (Post 4895391)
And then on second netconfig to change to static ip it might still be +X and trying to grab a dhcp addy

Right. I don't know what happens then.

stf92 02-19-2013 02:57 PM

Yes, it is there and is executable.

NeoMetal 02-19-2013 03:03 PM

Ok, as root just chmod -x /etc/rc.d/rc.networkmanager so that networkmanager doesn't start and interfere with your static settings, then probably simplest to reboot at that point once more

stf92 02-19-2013 03:25 PM

Yes, I already did, and now ifconfig shows the ip I set. How clever you observation. Thank you very much.

NeoMetal 02-19-2013 03:28 PM

Cool! Now next time you you add a computer you should be able to set static ip, set gateway to your router in your first time on netconfig, and all should work and you know how to do it :)

Alien Bob 02-19-2013 04:06 PM

Had you read http://docs.slackware.com/start?id=s...e_your_network then this whole thread would not have been necessary.

Eric

tronayne 02-20-2013 12:13 PM

Quote:

Originally Posted by stf92 (Post 4895111)
Yes, I did that. I also reset the modem, the router and the machines several times: no use. I in A I do

ifconfig eth0 192.168.0.2

then all is fine. But when I reboot, I am again 192.168.0.100!

Don't forget to take the "ifconfig" out of your file in /etc/rc.d -- if you don't, it may come back to haunt you sooner or later...

Martinus2u 02-20-2013 01:25 PM

Just to complicate matters further, it is totally possible to continue to use dhcpcd (the DHCP Client Daemon) and assign static IP addresses. You just have to configure /etc/dhcpcd.conf accordingly. I have found that approach superior to /etc/rc.d/rc.inet1.conf on at least one occasion.

eloi 02-23-2013 04:35 PM

Check router ip range
 
@stf92

I know that this thread is marked as solved but I have the impression that some
concepts are not clear enough.

I assume you've already understood that the dynamic IP provided by your ISP is
the external IP. What you are configuring is your LAN.

Router web interfaces are a bit confusing. You should not disable dhcp in your
router. Just do not use it (client) in your machines. Your router will use
dhcp client to connect to your ISP and dhcp server to assign IPs to your LAN
machines. Perhaps it will let you pre define some "static leases" where you
associate the MAC address of each network interface with a static IP (mine let
me add the host name of each machine too).

Take in care that routers generally ask you to define a "range" of ips to
assign, so if that range is 192.168.0.100 - 192.168.0.200 and you put
192.168.0.2 in rc.inet1.conf it will not work (probably what happened to
you).

What you showed on your first post for rc.inet1.conf is OK (unless 192.168.0.2
is not in the router's pre defined range like I've explained above).

You can add to /etc/resolv.conf:

Code:

search local
nameserver 192.168.0.1

to ask names to your router or:

Code:

nameserver 8.8.8.8
nameserver 8.8.4.4

if you want your machine uses google's. Should work in both cases.

You can add to /etc/hosts in both machines (I have a
linux embeded in my router so I ssh access it and edit /etc/hosts with the same
values).

Code:

127.0.0.1        localhost
192.168.0.1        routername.local        routername
192.168.0.100        machine1.local                machine1
192.168.0.101        machine2.local                machine2


Your router configuration is what you should investigate first.

-


All times are GMT -5. The time now is 10:19 PM.