You are not logged in.

#1 2014-04-21 07:56:14

stuartiannaylor
Member
Registered: 2014-03-24
Posts: 17

/etc/hosts

Add the same hostname to /etc/hosts:
/etc/hosts
#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1    localhost.localdomain    localhost myhostname
::1        localhost.localdomain    localhost

Thats the example from the wiki and being a arch noob just wanted to check.

I was expecting that for the loopback adapter then another entry on 127.0.1.1 so the above would be with my example of samba1.samba4.lan

Add the same hostname to /etc/hosts:
/etc/hosts
#<ip-address>    <hostname.domain.org>    <hostname>
127.0.0.1    localhost.localdomain    localhost
127.0.1.1  samba1.samba4.lan samba1
::1        localhost.localdomain    localhost

Also if I was on a static then I would also add that IP below 127.0.1.1

Just checking as a bit confused.

Offline

#2 2014-04-21 08:23:49

andy123
Member
Registered: 2011-11-04
Posts: 169
Website

Re: /etc/hosts

So… your question is what exactly? I mean, I like the /etc/hosts file which is why I clicked this thread and I can tell you some stuff about it (most likeley less than the manpage), but you should probably still put a questionmark in there somewhere, or something like that.


i'm sorry for my poor english wirting skills…

Offline

#3 2014-04-21 08:38:48

stuartiannaylor
Member
Registered: 2014-03-24
Posts: 17

Re: /etc/hosts

Sorry the second example is what I thought I should enter.

The first is in the wiki.

Like I say the wiki says add the hostname in a 127.0.0.1 localhost.localdomain samba1 fashion.

Not sure of how the FQDN should be added.

That is why I wrote I expected it to be on 127.0.1.1 where I have host and domain declared.

Is 127.0.1.1 correct?

Apols as I am used to ifconfig and a lot of what my normal network knowledge seems to be slightly different and it has thrown me slightly.

Then my eth0 has become enp0s3 no bother but again threw me.

There are no udev rules?

in /etc/netctl/interfaces I have nothing but dhcp seems to work fine.

Just a noob with a confused expresion.

Last edited by stuartiannaylor (2014-04-21 08:46:34)

Offline

#4 2014-04-21 08:46:30

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: /etc/hosts

What exactly are you trying to do?

Offline

#5 2014-04-21 08:53:15

stuartiannaylor
Member
Registered: 2014-03-24
Posts: 17

Re: /etc/hosts

Apols,

Going to install samba4 on a dhcp interface.

Changed the hostname to samba1

/etc/hosts usually I add fqdn, hostname on 127.0.1.1 and not 127.0.0.1 so slightly confused of the format for /etc/hosts
samba1.samba4.lan is what I am trying to do.

Then with dhclient I was expecting to add something like

  supersede host-name "spaceship";
  supersede domain-name "domain.home";
  supersede domain-name-servers 127.0.0.1;

So the local DNS and forwarder is used rather than my router DNS.

My debian / ubuntu knowledge is a bit flumoxed smile

I am reading https://wiki.archlinux.org/index.php/Dhcpcd so maybe I will get there

I do like the idea of fallback profiles.

Just trying to work out how to get resolv.conf as it is at the moment from dhcp
domain dlink.com
nameserver 192.168.1.1

to

domain samba4.lan
nameserver 127.0.0.1

Also rather than the loopback I would like to have the dchpcd ip address declared.

Still reading smile

Last edited by stuartiannaylor (2014-04-21 09:22:39)

Offline

#6 2014-04-21 10:53:43

stuartiannaylor
Member
Registered: 2014-03-24
Posts: 17

Re: /etc/hosts

Still rather puzzled about the dhcpcd hooks and scripts. Anyone got any examples.

Also /etc/hosts should hosts be declared on 127.0.0.1 or should another line exist for 127.0.1.1 ?

Stuart

Offline

#7 2014-04-21 12:58:26

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: /etc/hosts

stuartiannaylor wrote:

Also /etc/hosts should hosts be declared on 127.0.0.1 or should another line exist for 127.0.1.1 ?

I was the one that added that section to the Beginner's Guide. The computer hostname should be added to "127.0.0.1", also known as "home". Here is the reason (I'm kind of guessing here...):

For example, if your computer is named "barbara", some applications will try to connect to "barbara" by referencing the "/etc/hosts" file. If "barbara" doesn't point to "home", then it will take a long time for the connection to time out and move on. One symptom is some KDE applications will run very slowly even on very fast hardware.

...I don't care what you put into your "/etc/hosts" file, of course, but that's why that section is in the Beginner's Guide. Your hostname should point to "127.0.0.1".

Offline

#8 2014-04-21 16:23:47

R00KIE
Forum Fellow
From: Between a computer and a chair
Registered: 2008-09-14
Posts: 4,734

Re: /etc/hosts

If you are running systemd _and_ you have the line 'hosts: files dns myhostname' in your /etc/nsswitch.conf you don't need to add your hostname to /etc/hosts.

The other thing is that in case you need/want to add your hostname to /etc/hosts you need to do it to 2 lines, one for IPv4 and another for IPv6 if you are using IPv6, otherwise you may see strange breakage. It would look like this:

#<ip-address>	<hostname.domain.org>	<hostname>
127.0.0.1	localhost.localdomain	localhost myhostname
::1		localhost.localdomain	localhost myhostname

R00KIE
Tm90aGluZyB0byBzZWUgaGVyZSwgbW92ZSBhbG9uZy4K

Offline

#9 2014-04-21 17:27:25

stuartiannaylor
Member
Registered: 2014-03-24
Posts: 17

Re: /etc/hosts

Was no criticism guys. Absolute love Arch but it is very cutting edge. Previously for me it was always ifconfig.

ip link I get it brilliant lists my adapters and IP. Just had me head scratching.

Thanks for the IPv6 as yes important.

Its not Arch generally resolv always confuses me especially with local DNS and dhcp.

My solution was to to add what you suggested to /etc/hosts

Also resolvconf.conf

# Configuration for resolvconf(8)
# See resolvconf.conf(5) for details

resolv_conf=/etc/resolv.conf
# If you run a local name server, you should uncomment the below line and
# configure your subscribers configuration files below.
domain="samba4.lan"
search_domains="samba4.lan"
name_servers=127.0.0.1

So I have samba4 running as a dhcp client andcan just edit the above if I want the complete dhcp results.
Also samba4 4.1.7 in the arch repo on the 17th which was released by samba on the 17th!

Wow guys brilliant.

Offline

#10 2014-04-21 17:30:49

stuartiannaylor
Member
Registered: 2014-03-24
Posts: 17

Re: /etc/hosts

PS I have been making virtual box ova's of several distro's running samba4.

On there I have included my horrible hack to include samba4 methods into a webmin module.
https://sourceforge.net/projects/samba4 … 4.1.7ext4/?

Please its the first thing I have ever done with perl and haven't hacked developed anything for over a decade so well aware of the quality.

It does make an interface to samba-tool though.

Offline

#11 2014-04-30 23:58:55

torpet
Member
Registered: 2014-03-15
Posts: 5

Re: /etc/hosts

Every other day somebody seems to add/delete the /etc/hosts part in the wiki about adding your hostname to it.

Is it recommended now or not?

Offline

Board footer

Powered by FluxBB