LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Substituting a machine in the LAN caused it to lose the connection. (https://www.linuxquestions.org/questions/slackware-14/substituting-a-machine-in-the-lan-caused-it-to-lose-the-connection-4175450537/)

stf92 02-18-2013 09:24 AM

So I must put USE_DHCP[0]="no"? But then I cannot have internet. Or can I?

NeoMetal 02-18-2013 10:36 AM

You can still have internet, a public facing dhcp address is assigned to your broadband modem / router , your network behind that router (using the router as a gateway) can use static local range addresses (assuming this is a standard home network NAT setup, the router will translate your local addresses appropriately when connecting to machines on the internet )

stf92 02-18-2013 11:40 AM

So I choose the local addresses in /etc/hosts. And how do I make those addresses static?

onebuck 02-18-2013 01:48 PM

Member Response
 
Hi,

You can setup static IP address in '/etc/rc.d/rc.inet1.conf' for device[#]
Quote:

# Config information for eth0:
IPADDR[0]="192.168.1.14"
NETMASK[0]="255.255.255.0"
When rc.inet1 runs then the '/etc/rc.d/rc.inet.conf' is used.

As to the range of IP that is up to you. Do not forget the 'dhcp' assignment ranges.

onebuck 02-18-2013 01:57 PM

Member Response
 
Hi,

One other thing, I set my local '/etc/hosts' to reflect the IP to hostnames on my LAN

Quote:

AME
hosts - static table lookup for hostnames

SYNOPSIS
/etc/hosts

DESCRIPTION
This manual page describes the format of the /etc/hosts file. This file is a simple text file that associates IP addresses with hostnames, one line
per IP address. For each host a single line should be present with the following information:

IP_address canonical_hostname [aliases...]

Fields of the entry are separated by any number of blanks and/or tab characters. Text from a "#" character until the end of the line is a comment, and
is ignored. Host names may contain only alphanumeric characters, minus signs ("-"), and periods ("."). They must begin with an alphabetic character
and end with an alphanumeric character. Optional aliases provide for name changes, alternate spellings, shorter hostnames, or generic hostnames (for
example, localhost).

The Berkeley Internet Name Domain (BIND) Server implements the Internet name server for UNIX systems. It augments or replaces the /etc/hosts file or
hostname lookup, and frees a host from relying on /etc/hosts being up to date and complete.
For a SOHO this can be an advantage when working between IP assigned machines on the LAN. Easier to remember a host name than a assigned IP if you have multiple machines on the LAN.

stf92 02-18-2013 03:51 PM

I put, in /etc/rc.d/rc.inet1.conf, in one of the machines
Code:

IPADDR[0]="192.168.0.102"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]="yes"
DHCP_HOSTNAME=""

I booted and then did ifconfig. But it displayed

eth0 inet 192.168.0.101

which was the old ip. So the system doesn't read rc.inet1.conf?

TobiSGD 02-18-2013 04:05 PM

You have set up DHCP and a static IP, this won't work, use one or the other, not both.

stf92 02-18-2013 04:07 PM

But I want static IPs for the local hosts and DHCP for the internet.

TobiSGD 02-18-2013 04:36 PM

Your local Lan has absolutely nothing to do with the settings that the router has for connecting to the Internet. The settings for the router have to be done on the router itself, not on the local machines. All your local machines need is an address for the gateway to access the Internet, the gateway is your router.

onebuck 02-18-2013 08:45 PM

Member Response
 
Hi,

Quote:

Originally Posted by stf92 (Post 4894636)
I put, in /etc/rc.d/rc.inet1.conf, in one of the machines
Code:

IPADDR[0]="192.168.0.102"
NETMASK[0]="255.255.255.0"
USE_DHCP[0]="yes"
DHCP_HOSTNAME=""

I booted and then did ifconfig. But it displayed

eth0 inet 192.168.0.101

which was the old ip. So the system doesn't read rc.inet1.conf?

What is your dhcp server? Router or modem? You must be aware of the pool range for dhcp assignments. Most newer modems/routers have the means to use web admin to setup as desired.

You are making things complicated. For your static IP for each machine which are assigned by you. You can then setup '/etc/hosts' to reflect name and IP assignments to allow you to use the name. That is why 'man hosts' states;
Quote:

hosts - static table lookup for hostnames
From information in '/etc/hosts';
Quote:

#
# hosts This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server. Just add the names, addresses
# and any aliases to this file...
#
# By the way, Arnt Gulbrandsen <agulbra@nvg.unit.no> says that 127.0.0.1
# should NEVER be named with the name of the machine. It causes problems
# for some (stupid) programs, irc and reputedly talk. :^)
#
# For loopbacking.

127.0.0.1 localhost

#07-27-06 22:30 gws
#new hosts section
##
#
192.168.1.1 somemodem.workgroup modem #dsl modem
192.168.1.2 machinea.workgroup amachine #A
192.168.1.3 machineb.workgroup bmachine #B
192.168.1.4
...
...
#192.168.1.100 #dhcp pool can be assigned at the router/modem which is DHCP server
...
#192.168.1.130 #end pool
192.168.1.131 #another range
...
192.168.1.255 #end
Please notice the definition for the use of '/etc/hosts' above.

Hope this helps!

stf92 02-18-2013 11:18 PM

My ISP is Fibertel. When I subscribed their service they sent a technician home who installed a cable modem. That's all the equipment I had besides the computer connected to it, until recently when I bought a router and connected two computers and the cable modem to the router.

The router is a TP-LINK TL-WR740N. The box says it incorporates NAT and DHCP server. The modem is a Motorola Surboard 5051. Now, what I know is that the IP provided by the ISP is not static. It can change at any moment. All I need to know is 1) What entries do I need in /etc/rc.d/rc.inet1.conf:

IPADDR[0]= ?
NETMASK[0]= ?
USE_DHCP[0]= ?
DHCP_HOSTNAME= ?
GATEWAY= ?

2) What entries do I need in /etc/hosts. As I see it, /etc/hosts is not important. It only gives a name to the IPs, but I could use the IPs directly for that case. So the crucial point is what do I put in inet1.conf and perhaps something else.

Up to now I have been doing fine with USE_DHCP[0]="yes" and all other variables shown above empty (="") and /etc/hosts like this:

Machine 1:
127.0.0.1 localhost
127.0.0.1 MACH1.DN1 MACH1
192.168.0.101 MACH2.DN2 MACH2

Machine 2:
127.0.0.1 localhost
127.0.0.1 MACH2.DN2 MACH2
192.168.0.100 MACH1.DN1 MACH1

But these two IPs I did not choose them. I copied what I saw in ifconfig's output. And the main drawback is that these IPs change. They already explained to me it is because they are not static. But how to have them static and have Internet at the same time is a mystery to me.

allend 02-19-2013 12:39 AM

Quote:

But how to have them static and have Internet at the same time is a mystery to me.
What you want to do is set up address reservation in your router. I just downloaded a manual for your device from here http://www.tp-link.com.au/Resources/...User_Guide.pdf
See Section 4.7 DHCP and within that 4.7.3 Address Reservation

On your Slackware box, you want to set your Slackware box to get it's IP address by DHCP. This will be supplied by the DHCP server in the router.

stf92 02-19-2013 01:02 AM

Thank you for your post and link. I have the CD that came with the router, but the setup programs in it are for windows. The case of a Linux user has not been anticipated.

TobiSGD 02-19-2013 05:13 AM

Quote:

Originally Posted by stf92 (Post 4894832)
My ISP is Fibertel. When I subscribed their service they sent a technician home who installed a cable modem. That's all the equipment I had besides the computer connected to it, until recently when I bought a router and connected two computers and the cable modem to the router.

The router is a TP-LINK TL-WR740N. The box says it incorporates NAT and DHCP server. The modem is a Motorola Surboard 5051. Now, what I know is that the IP provided by the ISP is not static. It can change at any moment. All I need to know is 1) What entries do I need in /etc/rc.d/rc.inet1.conf:

IPADDR[0]= ?
NETMASK[0]= ?
USE_DHCP[0]= ?
DHCP_HOSTNAME= ?
GATEWAY= ?

2) What entries do I need in /etc/hosts. As I see it, /etc/hosts is not important. It only gives a name to the IPs, but I could use the IPs directly for that case. So the crucial point is what do I put in inet1.conf and perhaps something else.

Up to now I have been doing fine with USE_DHCP[0]="yes" and all other variables shown above empty (="") and /etc/hosts like this:

Machine 1:
127.0.0.1 localhost
127.0.0.1 MACH1.DN1 MACH1
192.168.0.101 MACH2.DN2 MACH2

Machine 2:
127.0.0.1 localhost
127.0.0.1 MACH2.DN2 MACH2
192.168.0.100 MACH1.DN1 MACH1

But these two IPs I did not choose them. I copied what I saw in ifconfig's output. And the main drawback is that these IPs change. They already explained to me it is because they are not static. But how to have them static and have Internet at the same time is a mystery to me.

You seem to have serious problems to understand that your local net (your PCs and the part of the router that faces towards that net) and the Internet provided by your ISP are totally independent. While your modem gets an IP from your ISP this has absolutely nothing to do with your local network. You can give your PCs static IPs (and in simple Linux networks this is normally desired), while your modem gets a dynamic IP via DHCP from your ISP.

So simply set up static IPs for your PC and disable DHCP on them, this will not prevent your modem from getting an dynamic ISP from your ISP.

273 02-19-2013 06:13 AM

Quote:

Originally Posted by allend (Post 4894874)
What you want to do is set up address reservation in your router. I just downloaded a manual for your device from here http://www.tp-link.com.au/Resources/...User_Guide.pdf
See Section 4.7 DHCP and within that 4.7.3 Address Reservation

On your Slackware box, you want to set your Slackware box to get it's IP address by DHCP. This will be supplied by the DHCP server in the router.

This is likely your easiest option. See section 3.2 on the bottom of page 9 of the linked PDF for instructions how to configure the router using your web browser.


All times are GMT -5. The time now is 09:23 PM.