1

I can ping my machine by IP and access all service or applications like ssh etc; but I can't using hostname. i used ifconfig to check the current DNS servers but they don't appear:

ens33    Link encap:Ethernet  HWaddr 00:0c:29:86:b6:cd
          inet addr:192.168.3.16  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe86:b6cd/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:74632 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5759 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:17811269 (17.8 MB)  TX bytes:429420 (429.4 KB)
          Interrupt:19 Base address:0x2000

i tried to use nslookup in the IP server (192.168.3.16) but it shows this :

    Server:         192.168.3.1
    Address:        192.168.3.1#53

** server can't find 16.3.168.192.in-addr.arpa: NXDOMAIN

it's an Ubuntu server, 14.04 on vmware work station 12.

2

2 Answers 2

0

Open up the /etc/hosts file and place your host name entries there like this:

192.168.0.1    lenovo-laptop
192.168.0.2    hp-laptop

Save it. And try to ping them by host name now:

$ ping -i 1 -c 4 -a lenovo-laptop
3
  • thank you for answer,it works but why can´t find the server by hostname by default, and what happens if the router change the server ip, will i have to change the hosts config in all machines again? Apr 6, 2017 at 22:42
  • What server are you talking about? In your local network, assuming you're not running a local DNS server or something like that, host names are things that are stored on each computer in the hosts file. If you don't have a host name entry for the IP address of a computer there, you will not be able to use the host name for that computer.
    – misha
    Apr 6, 2017 at 23:00
  • no, i do not have a DNS server. I will try config a local DNS server, thank you for the support, it was very helpful Apr 7, 2017 at 19:06
0

It's most likely a DNS problem. Which DNS server is your current system (where you are pinging from) is using? And does the DNS server have records of other nodes? You might need to create PTR records on DNS server. You can modify local host file but it is better to update/modify records on DNS server. I would start by looking at your DNS servers.

cat /etc/resolv.conf

This will tell you which DNS servers your local system is using. Then check these DNS servers for appropriate records.

3
  • If you have questions to ask for OP, comment under the post. If you can't comment, wait and gain some reputation. Your answer is not very helpful and specific but very broad in scope (assuming you're answering, not asking)
    – Anwar
    Apr 6, 2017 at 17:24
  • Also, why state what commands to run on Windows, if this is an Ubuntu (i.e. Linux) site? The OP specifically states that they are on Ubuntu Server 14.04. Apr 6, 2017 at 17:27
  • thanks for replay, the ping i put the commands ifconfig to chek the current dns servers and it dont appear and try to use nslookup in the ip server (192.168.3.16) shows this :server can't find 16.3.168.192.in-addr.arpa: NXDOMAIN Apr 6, 2017 at 22:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .