I have given full host/domainnames in my /etc/hosts and that seems to be interpreted by hostname -d:
henk@boven:~> hostname
boven
henk@boven:~> hostname -d
henm.xs4all.nl
henk@boven:~> grep boven /etc/hosts
10.0.0.154 boven.henm.xs4all.nl boven
127.0.0.2 boven.henm.xs4all.nl boven
henk@boven:~>
Other systems on my LAN have the same domain name. Apart from the top level it is not known in internet DNS servers. I guess you may name that “internal”. It is more a sort of joke for me.
You’ll need to describe a bit better what you’re trying to set up.
In a teeny tiny network, a Domain name might be equivalent to a Workgroup Name, and in that case you can set the name entirely within YaST Network Settings and possibly with additional entries in /etc/hosts
But if you intend to do more than what is possible in a Workgroup like apply a common network security to logins, machines and resources like websites, you can’t do that entirely within YaST > Network Settings… You’d instead have to be looking at setting up something like LDAP or AD.
And, if your CA is integrated with your network security, that’s a further indication that you’d have to set up LDAP or AD. Otherwise, if for instance your websites won’t have anything to do with your LAN users, then the CA can be unassociated with your network security.
If you’re already setting up websites with SSL, how are your current certificates being generated, are they self-signed?
If a LAN then, there’s a Router somewhere which, provides the private IP addresses for that LAN via DHCP and, has also provided a private Domain Name for that LAN.
Take a look at your Router’s documentation.
For example, I use an AVM FRITZ!Box DSL Router – the default Domain Name for the LAN «with private IP addresses» is “fritz.box” which AFAICS can not be changed …
If you’ve installed “nmap”, you can take a look at what’s been supplied by your DHCP server by using using “nmap --script broadcast-dhcp-discover” – this command needs system administrator privileges – either the user “root” or, “sudo” from a “normal” user.
Yes, that worked up through Leap 42.3, but is no longer there.
How to set the internal domain name?
I usually set it in my router, which provides it via DHCP.
Alternatively, I can set it by editing “/etc/HOSTNAME” to the form “hostname”.“domainname”. I think that was already setup here during install, because the installer got the information from the router.
However:
hostname -d
returns nothing (empty string), because I am using “wicked”. If I switch to “NetworkManager”, then “hostname -d” will return the answer that I want. I have an entry in “/etc/hosts” which keeps “sendmail” happy, but “hostname -d” doesn’t seem to use that.
I don’t think it matters. You can try:
grep search /etc/resolv.conf
and that returns the appropriate value. So DNS lookups are indeed using that domain name.
If the needed search line is there, then I don’t think you need to do anything.
When you depend on your router’s DHCP to assign a Domain/Workgroup name, you pretty much also need to check that box in your machine’s Network Settings to allow the DHCP to provide a name for your machine. When this happens, this does not over-write your machine’s internal settings, but provides an alias (alternative name) your machine will be known by when other machines in the network query for your machine.
Because the setting only provides an alias, your machine’s local resolution may not work… The local machine’s value has to be null (no entry) for the alias to possibly be queried. If there is a setting that’s different, then your machine will resolve to your local machine’s setting.
But of course, this can all be generally be invalidated if the real purpose is to set up some kind of integrated network security like LDAP or AD.
Explanation
|127.0.0.7
|
|private IP address, last number freely chosen
|
|pc-mife.pix.lan
|hostname, domain.tld freely chosen
|
|pc-mife
|short name freely chosen
|
|192.168.2.120
|IP of my computer
|
My learning: Yast was build for a reason - use it.
@mife
Your solution has all the drawbacks I described in my previous post… I don’t know the reason for setting up your website to use Host Headers resolution, but what you’ve done configuring Hostnames the way you described is not only incorrect but will still support only one website (Of course, only if you mapped the name to the IP address and port your website is using)
I recommend you do a simple Internet search to understand what a Hostname and a Domain Name are. Whether YaST uses input validation to ensure correct practice or not, you should understand what is correct and what isn’t.
@hcvv
Actually, there is a big difference editing $HOSTNAME vs entries in /etc/hosts although the @OP in this case thinks he solved his problem with what he did. The point is, I can see what he did solves his immediate problem but potentially screws up other configurations and functions… Potentially only because it’s also possible he never creates another website that requires Host Headers resolution, and he never runs another application that uses $HOSTNAME in a proper way.
The mapping to 127.0.0.x isn’t rubbish if he chooses to query his local machine by IP address, which would then enable the $HOSTNAME resolution to access his website. What he’s done is not correct, but can work in a very narrow and specific case. If you’re referring to 127.0.0.7 vs the more usual 127.0.0.1, it’s perfectly legal. The two are entirely different interfaces but both automatically default to the local machine.