Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
dnsmasq can resolve fqdn of server but can not ping
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
SteveYin
Tux's lil' helper
Tux's lil' helper


Joined: 20 Oct 2004
Posts: 91

PostPosted: Thu May 29, 2014 6:21 am    Post subject: dnsmasq can resolve fqdn of server but can not ping Reply with quote

I have a lan with a gateway/dhcp/samba server, now I want to switch to use dnsmasq as a name/dhcp server, so I have these in my dnsmasq.conf
Code:

domain-needed
bogus-priv
no-resolv
no-poll
server=61.155.5.6
server=122.200.77.34
local=/mylan.com/
interface=enp5s0
domain=mylan.com,192.168.0.0/24
dhcp-range=192.168.0.20,192.168.0.240,12h
cache-size=4096
no-negcache
log-dhcp


and this in my /etc/hosts
Code:

127.0.0.1       localhost
::1             localhost
192.168.0.1     server.mylan.com


if I add some dummy server to dnsmasq like address=/dummy.mylan.com/192.168.0.x, then I can nslookup the dummy or dummy.mylan.com, and also can ping these two hosts.

but my server's name is server, and I can nslookup server.mylan.com or nslookup server, both will give me correct ip address of 192.168.0.1, but I can not ping the server.mylan.com, the ping command on windows give me this
Code:

Ping request could not find host server.mylan.com. Please check the name and try again.


so what's wrong with my config? my server's ip address are static to 192.168.0.1, how can I both ping server and server.mylan.com?
_________________
Steve Yin
Back to top
View user's profile Send private message
SteveYin
Tux's lil' helper
Tux's lil' helper


Joined: 20 Oct 2004
Posts: 91

PostPosted: Thu May 29, 2014 6:27 am    Post subject: Reply with quote

got it!

the /etc/hosts file can only have the hostname part, so hosts file can only have
192.168.0.1 server
and can not use the fqdn name in hosts file

then add a address line to dnsmask.conf like
address=/server.mylan.com/192.168.0.1

then this will allow ping both server and server.mylan.com
_________________
Steve Yin
Back to top
View user's profile Send private message
khayyam
Advocate
Advocate


Joined: 07 Jun 2012
Posts: 2342

PostPosted: Thu May 29, 2014 12:37 pm    Post subject: Reply with quote

SteveYin wrote:
the /etc/hosts file can only have the hostname part, so hosts file can only have 192.168.0.1 server and can not use the fqdn name in hosts file

SteveYin ... yes it can ...

Code:
# echo "204.187.15.12 forums.gentoo.org" >> /etc/hosts
# ping -c 1 forums.gentoo.org
PING forums.gentoo.org (204.187.15.12) 56(84) bytes of data.
64 bytes from forums.gentoo.org (204.187.15.12): icmp_seq=1 ttl=50 time=189 ms

--- forums.gentoo.org ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 189.336/189.336/189.336/0.000 ms

best ... khay
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