You are not logged in.

#1 2008-04-07 17:45:33

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

Static vs. DHCP configuration: Arch-specific details

Hi,

I'm a recent Arch convert (after seven years of Slackware, Debian and CentOS). I have a few questions about details that I didn't quite get in the Wiki section.

1) static IP

The sample line in rc.conf is explicit enough, so this one is no problem. On the other hand, there are some diverging hints concerning the configuration in /etc/hosts. Let's say I configured a server with a static IP of 192.168.1.1/255·255.255.0. In that case, is it correct to have an /etc/hosts that looks like this?

127.0.0.1        localhost.localdomain    localhost
192.168.1.1        buildbox.localdomain    buildbox

Or is it:

127.0.0.1                  localhost.localdomain buildbox.localdomain localhost buildbox

???

2) DHCP

If I configure my Ethernet interface with DHCP, what do I have to put in /etc/hosts? Only the localhost line?


Dyslexics have more fnu.

Offline

#2 2008-04-07 17:54:46

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,718
Website

Re: Static vs. DHCP configuration: Arch-specific details

I'm an ex-Slack user and I must say that the configs are very much the same.
So,  Question 1:
Both are correct.
You can use whichever you like better.

Question 2:

HOSTNAME="your_computer_name"
#
# Interfaces to start at boot-up (in this order)
# Declare each interface then list in INTERFACES
#   - prefix an entry in INTERFACES with a ! to disable it
#   - no hyphens in your interface names - Bash doesn't like it
#
# Note: to use DHCP, set your interface to be "dhcp" (eth0="dhcp")
#
eth0="dhcp"
lo="lo 127.0.0.1"
INTERFACES=(lo eth0)
#
# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.0.1"
ROUTES=(!gateway)

Notice that you do not need the gateway since ROUTES declares it not in use as it is provided by the dhcp server.

Hope this helps.

Offline

#3 2008-04-07 18:40:13

schivmeister
Developer/TU
From: Singapore
Registered: 2007-05-17
Posts: 971
Website

Re: Static vs. DHCP configuration: Arch-specific details

Yeah, you don't really need to inject anything into /etc/hosts


I need real, proper pen and paper for this.

Offline

#4 2008-04-07 20:56:28

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

Re: Static vs. DHCP configuration: Arch-specific details

OK, thanks very much!


Dyslexics have more fnu.

Offline

#5 2008-04-10 11:25:05

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

Re: Static vs. DHCP configuration: Arch-specific details

Yeah, you don't really need to inject anything into /etc/hosts

I'd say this is partially wrong. When I only keep the default /etc/hosts, I get a warning message when XFCE starts up: it complains that there's no hostname defined.

Finally, I'm using this configuration:

127.0.0.1    buildbox.local         buildbox 
127.0.0.1    localhost.local        localhost

Note: The double 127.0.0.1 is only for better readability.

But I just notice something else, that puzzles me a bit. Here's what ifconfig returns, as expected:

[root@buildbox:~] # ifconfig

eth0      Link encap:Ethernet  HWaddr 00:20:ED:B8:E8:EC  
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::220:edff:feb8:e8ec/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:891 errors:0 dropped:0 overruns:0 frame:0
          TX packets:457 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:194025 (189.4 Kb)  TX bytes:103657 (101.2 Kb)
          Interrupt:16 Base address:0xf00 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:52 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:3470 (3.3 Kb)  TX bytes:3470 (3.3 Kb)

And here's the network section of my /etc/rc.conf:

# DHCP:     Set your interface to "dhcp" (eth0="dhcp")
# Wireless: See network profiles below
#
eth0="eth0 192.168.1.1 netmask 255.255.255.0 broadcast 192.168.1.255"
INTERFACES=(eth0)

# Routes to start at boot-up (in this order)
# Declare each route then list in ROUTES
#   - prefix an entry in ROUTES with a ! to disable it
#
gateway="default gw 192.168.1.254"
ROUTES=(gateway)

What puzzles me: I didn't define anything localhost-like in rc.conf, and yet it's there. How comes?

Last edited by kikinovak (2008-04-10 11:29:19)


Dyslexics have more fnu.

Offline

#6 2008-04-10 11:46:05

brain0
Developer
From: Aachen - Germany
Registered: 2005-01-03
Posts: 1,382

Re: Static vs. DHCP configuration: Arch-specific details

The loopback interface is always there, you don't need to configure it.

Offline

#7 2008-04-10 12:01:58

kikinovak
Member
From: Montpezat (South France)
Registered: 2005-12-07
Posts: 96
Website

Re: Static vs. DHCP configuration: Arch-specific details

OK, thanks for all the explanations!


Dyslexics have more fnu.

Offline

#8 2008-04-10 21:46:38

ralvez
Member
From: Canada
Registered: 2005-12-06
Posts: 1,718
Website

Re: Static vs. DHCP configuration: Arch-specific details

There are two ways in which you can do this.

1) 127.0.0.1    localhost.localdomain        localhost  buildbox

2) 127.0.0.1    localhost.localdomain        localhost
    192.168.1.1 buildbox.localdomain        buildbox


Both are valid to identify the loopback and your machine by name. The first one is better, in my opinion,  (because is shorter wink ) but that's a matter of taste.

Hope this helps.

R.

Offline

Board footer

Powered by FluxBB