Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Setting domainname
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
salmonix
Guru
Guru


Joined: 16 Jul 2006
Posts: 410

PostPosted: Tue Jun 24, 2008 2:29 pm    Post subject: Setting domainname Reply with quote

Can sb explain me the differences of setting domainname in
1) /etc/conf.d/domainname,
2) /etc/conf.d/net file,
3) /etc/sysctl.conf
4) /etc/hosts ?

and probably their relation with dnsmasq domain option?

Thnx!
_________________
Quis custodiet ipsos, custodes?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Sat Jun 28, 2008 2:24 pm    Post subject: Reply with quote

/etc/conf.d/domainname isn't used anymore
/etc/conf.d/net can set a DNS or NIS domain name
/etc/sysctl.conf only sets a NIS domain name
/etc/hosts doesn't set any domain names as such - is purely a name -> ip lookup table

First ask why you need to set a DNS domain name, as 99% of the time you are wrong.
Making the unknown_domain go away on your terminal login isn't a valid answer :)
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
salmonix
Guru
Guru


Joined: 16 Jul 2006
Posts: 410

PostPosted: Tue Jul 01, 2008 11:09 am    Post subject: Reply with quote

Thanx. It was merely a question risen after reading some controversal docs and the picture i felt not clear.
_________________
Quis custodiet ipsos, custodes?
Back to top
View user's profile Send private message
Ph0eniX
Guru
Guru


Joined: 24 Sep 2004
Posts: 502
Location: New York, U.S.

PostPosted: Tue Jul 01, 2008 1:14 pm    Post subject: Reply with quote

UberLord wrote:
/etc/conf.d/domainname isn't used anymore
/etc/conf.d/net can set a DNS or NIS domain name
/etc/sysctl.conf only sets a NIS domain name
/etc/hosts doesn't set any domain names as such - is purely a name -> ip lookup table

First ask why you need to set a DNS domain name, as 99% of the time you are wrong.
Making the unknown_domain go away on your terminal login isn't a valid answer :)


The thing is that if you don't set your FQDN in /etc/hosts, hostname -f will not work. Ironically when I do, then my PPTP connection stops working. Go figure.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Jul 01, 2008 2:44 pm    Post subject: Reply with quote

Ph0eniX wrote:
The thing is that if you don't set your FQDN in /etc/hosts, hostname -f will not work. Ironically when I do, then my PPTP connection stops working. Go figure.


hostname -f merely looks up the FQDN in DNS if the hostname is not a FQDN.
The default libc setup will use /etc/hosts before looking up in DNS.

Why do you need hostname -f to report a FQDN anyway?
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Tue Jul 01, 2008 3:42 pm    Post subject: Reply with quote

I don't know about Ph0eniX, but I frequently need an FQDN, in order to run CAD (Computer Aided Design) tools when I'm working from home. Many of these tools have all sorts of licensing crap built-in, and for one particular tool suite, I have to have a forward and reverse resolvable FQDN that appears to be inside my employer's domain. If I don't have that, I get to sit waiting for all sorts of time-outs, and so far have never gotten any useful work done without the FQDN properly set. Maybe the software is broken, and I would agree with that assessment for other reasons, but it's what my employer has chosen for use on our designs, so we don't really have a viable choice. File-level compatibility, standards, I wish!

Incidentally, to set my FQDN to be "at work" I use the IP assigned through my employer's VPN and find the associated FQDN through a DNS lookup. Then I craft an entry in /etc/hosts to match, and use "hostname (shortname)" to set the name. After that, "hostname -f" returns the FQDN properly, even though I've only set the shortname. The shortname plus /etc/hosts is sufficient. The CAD software runs.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Jul 01, 2008 3:53 pm    Post subject: Reply with quote

depontius wrote:
I don't know about Ph0eniX, but I frequently need an FQDN, in order to run CAD (Computer Aided Design) tools when I'm working from home. Many of these tools have all sorts of licensing crap built-in, and for one particular tool suite, I have to have a forward and reverse resolvable FQDN that appears to be inside my employer's domain. If I don't have that, I get to sit waiting for all sorts of time-outs, and so far have never gotten any useful work done without the FQDN properly set. Maybe the software is broken, and I would agree with that assessment for other reasons, but it's what my employer has chosen for use on our designs, so we don't really have a viable choice. File-level compatibility, standards, I wish!


That's probably the first valid reason I've heard for setting a FQDN like that!

Quote:
Incidentally, to set my FQDN to be "at work" I use the IP assigned through my employer's VPN and find the associated FQDN through a DNS lookup. Then I craft an entry in /etc/hosts to match, and use "hostname (shortname)" to set the name. After that, "hostname -f" returns the FQDN properly, even though I've only set the shortname. The shortname plus /etc/hosts is sufficient. The CAD software runs.


Could do better :)
Install openresolv
Install a decent local resolver, like dnsmasq
Configure /etc/dnsmasq.conf according to /etc/resolvconf/update.d/dnsmasq

DHCP clients always wang their domains entries in "search".
OpenVPN wangs the domain in "domain". If you don't use OpenVPN in Gentoo, you'll need to make your VPN client 1) use resolvconf, and 2) wang the domain in domain if it uses search.
This enables all DNS queries for the VPN domain to goto the VPN server and all other queries to the DNS server specified by the DHCP client.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Tue Jul 01, 2008 8:27 pm    Post subject: Reply with quote

UberLord wrote:
depontius wrote:
Incidentally, to set my FQDN to be "at work" I use the IP assigned through my employer's VPN and find the associated FQDN through a DNS lookup. Then I craft an entry in /etc/hosts to match, and use "hostname (shortname)" to set the name. After that, "hostname -f" returns the FQDN properly, even though I've only set the shortname. The shortname plus /etc/hosts is sufficient. The CAD software runs.


Could do better :)
Install openresolv
Install a decent local resolver, like dnsmasq
Configure /etc/dnsmasq.conf according to /etc/resolvconf/update.d/dnsmasq

DHCP clients always wang their domains entries in "search".
OpenVPN wangs the domain in "domain". If you don't use OpenVPN in Gentoo, you'll need to make your VPN client 1) use resolvconf, and 2) wang the domain in domain if it uses search.
This enables all DNS queries for the VPN domain to goto the VPN server and all other queries to the DNS server specified by the DHCP client.


I tried the "resolvconf" package a while ago, shortly after it first arrived for Gentoo. It didn't work for me, something wasn't getting triggered, because the directory structures seemed to be there, but the final result wasn't. I scripted a few kludges to force it to work, and then decided to just bag it, and script stuff myself to do what it did.

I am running dnsmasq, principally to act as a versatile resolver, as you suggest. The caching is unimportant in this situation, and can be a hindrance when the VPNs are coming up and going down, and I forget what my status is, and get a bogus resolution stuck in the cache.

I also run both OpenVPN for my own endpoint, and my employer's VPN for work access. Getting the latter to play well may be the biggest reason to stay scripted, rather than some more standard solution that presumes cooperative, friendly software.

But just in case, does openresolv work better than resolvconf did? (Or did you never have problems with either?)
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Wed Jul 02, 2008 9:11 am    Post subject: Reply with quote

depontius wrote:
I tried the "resolvconf" package a while ago, shortly after it first arrived for Gentoo. It didn't work for me, something wasn't getting triggered, because the directory structures seemed to be there, but the final result wasn't. I scripted a few kludges to force it to work, and then decided to just bag it, and script stuff myself to do what it did.


...

But just in case, does openresolv work better than resolvconf did? (Or did you never have problems with either?)[/quote]

You should have reported your issues so we could try and make it work how you like it.
openresolv does work better than resolvconf-gentoo and does fix some issues.
I never have a problem using my own software - or I wouldn't release it ;)

So lets chat about it.
How about wanging openresolv in (it's available in Gentoo) and if you have any issues with it then open a bug at http://bugs.marples.name/enter_bug.cgi?product=openresolv
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Wed Jul 02, 2008 12:34 pm    Post subject: Reply with quote

UberLord wrote:
You should have reported your issues so we could try and make it work how you like it.
openresolv does work better than resolvconf-gentoo and does fix some issues.
I never have a problem using my own software - or I wouldn't release it ;)

So lets chat about it.
How about wanging openresolv in (it's available in Gentoo) and if you have any issues with it then open a bug at http://bugs.marples.name/enter_bug.cgi?product=openresolv


I think I did report it at the time, but there were others making much more noise than me, and I was able to fix things on my own. I probably won't have the laptop back in the cradle until after the holidays, but I'll give "openresolv" a shot, then. As I said, I'm just a little fearful of making this work with the proprietary VPN software from my employer, but I'll see what I can do.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
hem
n00b
n00b


Joined: 16 Nov 2008
Posts: 4

PostPosted: Sun Nov 16, 2008 8:59 pm    Post subject: Reply with quote

My reason to set domainname:
I need to set a domainname for a software license. If its not set properly. the software don't start.

What i tryed:
1) /etc/conf.d/domainname -> is set, don't work

2) /etc/conf.d/net file -> (dns_domain_eth0="domainname") don't work and end in a little drawback, resolv.conf will be overwritten and kill nameserver settings on each start

3) /etc/sysctl.conf -> no idea whats to do here

4) /etc/hosts ? -> is set properly but don't affect domainname (only hostname -f works, but the software license ignore that)

5) The settomainname prog i found on this forum -> only work with a hostname like "hostname.domainname" with ends in a "hostname.domainname.domainname" on login with some routing trouble

So how can i set the domainname on startup?

Any help would be appreciated.
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Sun Nov 16, 2008 11:14 pm    Post subject: Reply with quote

I'm surprised you can't get it to work in /etc/conf.d/net - that's how I do it on my work machines. I'll check mine tomorrow and post. In the meantime you might post yours here.

I'm guessing that you're using dhcp. Is this on a laptop that moves to other networks, or a deskside that stays on your employer's lan? I have a static IP deskside at work, and that's simple. I also have a laptop that moves, and I handle the domain name on that with custom scripting. The case of a deskside with dhcp is simpler, in that /etc/conf.d/net will work, but you have to give it the right dhcp flags, as well. Basically, you don't want dhcp to overwrite /etc/resolv.conf, and you want to properly configure it yourself.
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
hem
n00b
n00b


Joined: 16 Nov 2008
Posts: 4

PostPosted: Mon Nov 17, 2008 6:15 am    Post subject: Reply with quote

I use a static ip. My conf.d/net is:
Code:
modules=( "ifconfig" )
config_eth0=( "192.168.100.65 broadcast 192.168.100.255 netmask 255.255.255.0" )
routes_eth0=( "default via 192.168.100.1" )
dns_domain="net"
dns_domain_eth0="net"
dns_domain_lo="net"
dns_servers_eth0="192.168.100.1"

But i don't think that the software is interested on interface settings. It parse the output of the domainname command to check the license-identifier of the machine.
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Nov 17, 2008 8:08 am    Post subject: Reply with quote

hem wrote:
It parse the output of the domainname command to check the license-identifier of the machine.


The domainname command is for the NIS domain, not the DNS domain.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Mon Nov 17, 2008 10:40 am    Post subject: Reply with quote

UberLord wrote:

The domainname command is for the NIS domain, not the DNS domain.


Well that's fascinating, to have a buried dependence on NIS like that. How prevalent was NIS, in it's day? I guess I figured they just parsed "hostname -f".
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
hem
n00b
n00b


Joined: 16 Nov 2008
Posts: 4

PostPosted: Mon Nov 17, 2008 7:24 pm    Post subject: Reply with quote

Ok, then i need to set NIS. My setting in /etc/domainname for NIS is the same as DNS. It seems i have to set some more.

The prog from genome https://forums.gentoo.org/viewtopic-t-51538-highlight-setdomainname.html takes the right NIS setting, but it should use the settings from /etc/domainname instead of hostname. Can anyone change the code on this way?
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Mon Nov 17, 2008 8:57 pm    Post subject: Reply with quote

Set nis_domain="net" in conf.d/net
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
depontius
Advocate
Advocate


Joined: 05 May 2004
Posts: 3509

PostPosted: Tue Nov 18, 2008 1:44 pm    Post subject: Reply with quote

UberLord wrote:
Set nis_domain="net" in conf.d/net


This looks handy, but if suddenly "domainname" starts returning something other than "(none)" will other programs start assuming that one is using NIS?
_________________
.sigs waste space and bandwidth
Back to top
View user's profile Send private message
UberLord
Retired Dev
Retired Dev


Joined: 18 Sep 2003
Posts: 6835
Location: Blighty

PostPosted: Tue Nov 18, 2008 1:49 pm    Post subject: Reply with quote

You don't have to belong to a nis domain to use nis.
So in order words, only badly coded programs should be affected.
_________________
Use dhcpcd for all your automated network configuration needs
Use dhcpcd-ui (GTK+/Qt) as your System Tray Network tool
Back to top
View user's profile Send private message
hem
n00b
n00b


Joined: 16 Nov 2008
Posts: 4

PostPosted: Sat Nov 22, 2008 12:35 pm    Post subject: Reply with quote

Quote:
nis_domain="net" in conf.d/net

Works great, thx for the help.

Btw: Setting dns_servers_eth0=... in addition to dns_domainname=... in /etc/conf.d/net will restore the lost DNS settings in /etc/resolv.conf
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum