You are not logged in.

#1 2008-11-11 18:50:41

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Basic LAN configuration, DHCP

Hi,

I'm quite new to networking, so my questions may not be quite smart smile . I've got an ADSL router (box1), a PC (alfabox) and a notebook (bravobox). IP addresses show like this: box1: 192.168.1.1, alfabox: 192.168.1.2, bravobox: 192.168.1.3.

Internet works, so basically the network is OK.

/etc/hosts files look like this:

127.0.0.1 localhost.localdomain localhost
127.0.0.1 alfabox.localdomain alfabox

127.0.0.1 localhost.localdomain localhost
127.0.0.1 bravobox.localdomain bravobox

/etc/resolve.conf (on both alfabox and bravobox):

nameserver 192.168.1.1

The boxes ping themselves and one another by IP addresses fine; ping themselves by hostnames also fine, but refuse to ping one another by hostnames:

[user@alfabox ~]$ ping -c 3 bravobox
ping: unknown host bravobox

What's missing?

Offline

#2 2008-11-11 19:35:20

Mektub
Member
From: Lisbon /Portugal
Registered: 2008-01-02
Posts: 647

Re: Basic LAN configuration, DHCP

Hi, Llama,

instead of:

127.0.0.1 alfabox.localdomain alfabox

substitute with:

192.168.1.2 alfabox

and nstead of:

127.0.0.1 bravobox.localdomain bravobox

substitute with:

1

192.168.1.3 bravobox

Mektub

Last edited by Mektub (2008-11-11 19:36:06)


Follow me on twitter: https://twitter.com/johnbina

Offline

#3 2008-11-11 20:06:46

Fuzzy_SPb
Member
From: Russia
Registered: 2008-11-10
Posts: 10

Re: Basic LAN configuration, DHCP

I think the best way is to have following /etc/hosts on each node (alfa, bravo and box1, if possible):

127.0.0.1   localhost.localdomain localhost
192.168.1.1 box1.localdomain      box1
192.168.1.2 alfabox.localdomain   alfabox
192.168.1.3 bravobox.localdomain  bravobox

Also, you mentioned DHCP. If you are using this protocol than you have to configure router to give fixed IP addresses to your PCs (otherwise you have to configure DNS server together with 'allow update' for DHCP).

Last edited by Fuzzy_SPb (2008-11-11 20:11:42)


Mandriva -> Fedora -> ArchLinux (and CentOS sometimes)

Offline

#4 2008-11-12 04:54:02

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

Re: Basic LAN configuration, DHCP

Fuzzy_SPb wrote:

I think the best way is to have following /etc/hosts on each node (alfa, bravo and box1, if possible):

127.0.0.1   localhost.localdomain localhost
192.168.1.1 box1.localdomain      box1
192.168.1.2 alfabox.localdomain   alfabox
192.168.1.3 bravobox.localdomain  bravobox

Also, you mentioned DHCP. If you are using this protocol than you have to configure router to give fixed IP addresses to your PCs (otherwise you have to configure DNS server together with 'allow update' for DHCP).

Wouldn't that make problems when you lose the connection to the router? I'd say for alfabox

127.0.0.1   localhost.localdomain localhost alfabox
192.168.1.1 box1.localdomain      box1
192.168.1.2 alfabox.localdomain   alfabox
192.168.1.3 bravobox.localdomain  bravobox

and for bravobox

127.0.0.1   localhost.localdomain localhost bravobox
192.168.1.1 box1.localdomain      box1
192.168.1.2 alfabox.localdomain   alfabox
192.168.1.3 bravobox.localdomain  bravobox

Offline

#5 2008-11-12 06:23:16

Fuzzy_SPb
Member
From: Russia
Registered: 2008-11-10
Posts: 10

Re: Basic LAN configuration, DHCP

rine wrote:

Wouldn't that make problems when you lose the connection to the router?

Why do you think so? My point of view:
Let's take for example alfabox. If you give ifconfig than you'll see at list lo and I suppose eth0(or may be some other) interfaces. lo will have address 127.0.0.1 and eth0 will have 192.168.1.2. So, if you have in /etc/hosts

127.0.0.1 localhost
192.168.1.2 alfabox

then you can give:
ping localhost - then packets will be routed via lo
ping alfabox - then packets will be routed via eth0 - address is local and located in our subnet, we don't need to route packets via router and packets will be sent directly to alfa (in case of ping bravobox - behaviour will be the same, router have no role in packets exchange inside subnet). So, I see no problem.

Last edited by Fuzzy_SPb (2008-11-12 06:23:51)


Mandriva -> Fedora -> ArchLinux (and CentOS sometimes)

Offline

#6 2008-11-12 07:53:30

rine
Member
From: Germany
Registered: 2008-03-04
Posts: 217

Re: Basic LAN configuration, DHCP

Yea well but what about programs that use your hostname instead of "localhost"? So if something uses "alfabox" on alfabox, it sees 192.168.1.2, which doesn't exist without dhcp server.

Fuzzy_SPb wrote:

ping alfabox - then packets will be routed via eth0 - address is local and located in our subnet, we don't need to route packets via router and packets will be sent directly to alfa (in case of ping bravobox - behaviour will be the same, router have no role in packets exchange inside subnet). So, I see no problem.

That should work with a static IP, not dhcp.

Last edited by rine (2008-11-12 07:54:49)

Offline

#7 2008-11-12 08:03:27

Fuzzy_SPb
Member
From: Russia
Registered: 2008-11-10
Posts: 10

Re: Basic LAN configuration, DHCP

Yes, you are right, I just forgot about DHCP server. smile


Mandriva -> Fedora -> ArchLinux (and CentOS sometimes)

Offline

#8 2008-11-12 10:15:36

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: Basic LAN configuration, DHCP

Thanks for interesting discussion! I've been having answers, and that's good. My real problem is my ignorance. There is a lot of howtos everywhere, but I have trouble using them because I don't understand the basics.

For instance:

Also, you mentioned DHCP. If you are using this protocol than you have to configure router to give fixed IP addresses to your PCs (otherwise you have to configure DNS server together with 'allow update' for DHCP).

Could you be more specific on this?

I took a look into router's browser interface (D-Link DSL-2640U); there's a lot op options. "Dynamic DNS", for instance:

Dynamic DNS
The Dynamic DNS service allows you to alias a dynamic IP address to a static hostname in any of the many domains, allowing your DSL router to be more easily accessed from various locations on the Internet.

Choose Add or Remove to configure Dynamic DNS.
   
Hostname     Username     Service     Interface     Remove

Is it the place worth looking into?..

I understand that I have a couple of choices; what are they, what are pros and cons? It's a home network with a couple of boxes, with possible guest computers; also I'm going to put Samba server and Subversion (svnserve) on the stationary box. I need the simplest of trouble free solutions, that's all smile . Also I'd appreciate any link where the relevant basics are discussed (it looks like there's no shortage of manuals).

Offline

#9 2008-11-12 10:54:26

Fuzzy_SPb
Member
From: Russia
Registered: 2008-11-10
Posts: 10

Re: Basic LAN configuration, DHCP

I mean interworking between DHCP and DNS servers. In your case I suppose that you have only DHCP server in your box, so you have to fix addresses for PCs mentioned in your /etc/hosts. "Dynamic DNS" options is useful with such services like www.dyndns.org - if you provider give you dynamic IP address then with this service you can assign name to your pc and use it for access to your network from internet.


Mandriva -> Fedora -> ArchLinux (and CentOS sometimes)

Offline

#10 2008-11-12 11:12:18

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: Basic LAN configuration, DHCP

Fuzzy_SPb - I've got a hunch that we live in one and the same city smile . Is that so?

Offline

#11 2008-11-12 11:19:10

Fuzzy_SPb
Member
From: Russia
Registered: 2008-11-10
Posts: 10

Re: Basic LAN configuration, DHCP

smile yes


Mandriva -> Fedora -> ArchLinux (and CentOS sometimes)

Offline

#12 2008-11-12 14:59:27

Llama
Banned
From: St.-Petersburg, Russia
Registered: 2008-03-03
Posts: 1,379

Re: Basic LAN configuration, DHCP

Well, a dumb question: if I hardcode IP addresses into /etc/hosts, do I run a risk that one fine day the router will give alfabox 192.168.1.3 and bravobox 192.168.1.2 ?

...

Did that; everything pings OK; enabled an NFS share on alfabox via Webmin; don't know how to look into the share from bravobox smile ...

Last edited by Llama (2008-11-12 15:20:02)

Offline

#13 2008-11-12 16:12:49

Fuzzy_SPb
Member
From: Russia
Registered: 2008-11-10
Posts: 10

Re: Basic LAN configuration, DHCP

1) If you fix given addresses on router in DHCP server parameters than it always be ok.
2) to share via NFS you have to add directory into /etc/exports on alfabox
to mount NFS folder you have to use mount -t nfs -o <options> alfabox:</remote/path> </local/path>

Last edited by Fuzzy_SPb (2008-11-12 16:13:41)


Mandriva -> Fedora -> ArchLinux (and CentOS sometimes)

Offline

Board footer

Powered by FluxBB