On client side In /etc/hosts file we have enter localhost <hostname>
but when i go to the address in browser **http://localhost:631 >> Administration>> page_log
**we can only see the IP Address instead of hostname in the page log. what else changes is needed???
Apart from this Everything is working well , need solution for the hostname entity.
Please always show real data, else we will not be able to detect any errors you made. I am not convinced that this is littarally what you have in /etc/hosts. And when you have it, it is incorrect.
Thh man page says:
IP_address canonical_hostname [aliases...]
and localhost is not an IP address, nor is <hostname> a valid hostname.
I just show the format above actual entries are
localhost kef-ho-lap
127.0.0.1 kef-ho-lap
these are the entries in the /etc/hosts file and i have also check with the static ip and and with FQDN entry in /etc/hosts file but still i am getting only Ip address in the page log not hostname what else changes is needed in the system to get the hostname in the page log of the cups server.
The mapping entry needs to be in the /etc/hosts file residing the machine hosting the CUPS server. (It’s really only useful for small and static LAN environments where no domain name server is in use.)
The first one is an invalid line for /etc/hosts.
The second one should at least read
127.0.0.1 localhost
else all references to localhost can not be resolved.
When you want kef-ho-lap also to be resolved to 127.0.0.1 then make it an alias
127.0.0.1 localhost kef-ho-lap
When you want a reverse lookup of 127.0.0.1 be resolved as kef-ho-hap instead of localhost, you could change that to
127.0.0.1 kef-ho-hap localhost
but I am not sure if that is a good idea.
I do not know if kef-ho-hap is the hostname of the system (which one, CUPS client or CUPS server) you are talking about. Normally the hostname is connected to the IP address of the NIC connected to the LAN, not to 127.0.0.1. This would result in something like:
127.0.0.1 localhost
192.168.1.15 kef-ho-hap
And the last one should be both in your client and your server system to have consistency in your network.
But I can be that I totally misunderstand what you are doing., I only saw your ununderstandable /etc/hosts entry and as long as that is not correct, I doubt you can solve any problem you encounter in this field.
My understanding is that the OP appears to want the machine hosting the CUPS server to be able to log the hostname of the client(s) rather than the IP address(es). When that is the case then the desired mapping needs to be in /etc/hosts of the same machine (assuming dnsmasq or some other name server resolution is not employed already).
I agree with you. The OP is not very clear with what he has done where. Thjer is no good explanation on what he does or did on the CUPS server and what on the CUPS client.
So trying to recap your and my observations.
What I am not sure of is if the CUPS client already puts the clients hostname in the conversation with the CUPS server. But then IMHO it would use the hostname derived from the hostname command or similar and not use some IP address active on the client.
So it is more likely the CUPS server tries to resolve the IP address of the client he is talking to. Then it is clear that resolving must take place on the CUPS server and I am not sure the OP show his /etc/hosts line frim the server (it is vague what he means IMHO and as long as I am not 100% sure of something, then I am suspicious).
And when the resolving must take place on the CUPS server, that never has anything to do with the word localhost. after ll it must resolve the IP address of the CUPS client as used in the LAN to the hostname of the CUPS client. That could be defined in /etc/hosts like
192.168.1.15 kef-ho-hap
(assuming that 192.168.1.15 is the IP address of the CUPS client and kef-ho-lap is the hostname of the same).
But as the OP somewhere states that he is using DHCP (I assume at least on the client), /etc/hosts is not an option and he must use the DNS server of his DHCP server (or other resolvers). In that case changing things in /etc/hosts manually is not a good idea, it will only break things.
Yes, more information about the OP’s LAN environment would help complete the picture. All too often crucial details are left out and we’re left to pay guessing games.
I have opensuse leap 42.2 server
In that i have configured the dns server along with the cups server in the same machine.
In this environment dhcp server is configured.
On cups server add line–In /etc/cups/cupsd.conf – HostNameLookups On
New client machine is ubuntu16.04 and windows
i have not made any changes on client machine,
i attached the page log format of cups server please refer it.
nsswitch file is :
passwd: compat sss files ldap [NOTFOUND=return] db
pre_auth-client-config # group: compat sss
group: compat sss files ldap [NOTFOUND=return] db
pre_auth-client-config # shadow: compat
shadow: compat sss files ldap [NOTFOUND=return] db
hosts: files mdns4_minimal [NOTFOUND=return] dns
networks: files
protocols: db files
services: db files
ethers: db files
rpc: db files
And Please, in the future use CODE tags around copied/pasted computer text in a post. It is the # button in the tool bar of the post editor. When applicable copy/paste complete, that is including the prompt, the command, the output and the next prompt.
This has many advantages. One of them that it makes a clear difference between computer facts (what is where we have to live on) and story telling.
Can you ping the client machine by it’s hostname, or resolve the hostname using nslookup?
For example if you do the following
nslookup 10.0.3.163
what name (if any is reported)?
For example, I get
linux-kgxs:/home/dean # nslookup 192.168.1.7
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
7.1.168.192.in-addr.arpa name = iPhone.
Authoritative answers can be found from:
linux-kgxs:/home/dean # nslookup 192.168.1.8
Server: 192.168.1.1
Address: 192.168.1.1#53
Non-authoritative answer:
8.1.168.192.in-addr.arpa name = linux-54cw.
Authoritative answers can be found from:
I can also ping a host on my LAN by name…
# ping linux-54cw
PING linux-54cw (192.168.1.8) 56(84) bytes of data.
64 bytes from linux-54cw (192.168.1.8): icmp_seq=1 ttl=64 time=2.77 ms
64 bytes from linux-54cw (192.168.1.8): icmp_seq=2 ttl=64 time=2.34 ms
64 bytes from linux-54cw (192.168.1.8): icmp_seq=3 ttl=64 time=4.27 ms
64 bytes from linux-54cw (192.168.1.8): icmp_seq=4 ttl=64 time=7.43 ms
^C
--- linux-54cw ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 2.346/4.207/7.438/1.999 ms