LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 01-15-2018, 03:03 PM   #1
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Rep: Reputation: Disabled
Using dnsmasq


I am on Ubuntu server 16, and my client is getting a dhcp address, but dns resolution is not working. When I attempt to visit a website, it fails to load. I've done everything here under Local DNS Cache: https://help.ubuntu.com/community/Dnsmasq. Some of the steps were different for me. I updated the listen address, then uncommented the lines in dhclient.conf. I then added a nameserver record for 8.8.8.8 under localhost. After restarting the service, it still fails to work. I look on the client, and the /etc/resolv.conf just has the local nameserver record. Shouldn't it mirror what's on the server, so also have 8.8.8.8? In dnsmasq.conf under /etc, I've added these lines to the end:
Code:
interface=p1p1
dhcp-range=192.168.1.5,192.168.1.253,72h
server=8.8.8.8
no-hosts
 
Old 01-15-2018, 04:01 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,976

Rep: Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678
You have to configure dnsmasq to listen on the server's IP address as well as allow DHCP/DNS traffic if the firewall is running for it to accept requests from clients.

You do not mention what distribution/version the client is running but Ubuntu's latest versions install dnsmasq by default which is configured as a DNS proxy so the /etc/resolv.conf will be localhost. If dnsmasq was not running on the client /etc/resolv.conf should reflect the IP address of the server.

Last edited by michaelk; 01-15-2018 at 04:38 PM.
 
Old 01-15-2018, 04:27 PM   #3
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Original Poster
Rep: Reputation: Disabled
It seems that they are running a different version. Could that be the issue?
The client is Ubuntu, but that will change, as it's just for testing. I will probably have a switch, then devices attached to that.
As for listening on the IP, would that just be appending it to this line: listen-address=127.0.0.1 ?
 
Old 01-15-2018, 04:43 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,976

Rep: Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678
Running a different version should not matter. Correct you should append your ethernet IP address.

listen-address=127.0.0.1,192.168.1.xxx
 
Old 01-15-2018, 05:10 PM   #5
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Original Poster
Rep: Reputation: Disabled
That did not help.

Here are some of my iptable rules that are applicable:

Code:
-A INPUT -i p1p1 -p udp -m udp --sport 67:68 --dport 67:68 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 53 -m state --state ESTABLISHED -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -m state --state ESTABLISHED -j ACCEPT
-A OUTPUT -p tcp -m tcp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
-A OUTPUT -p udp -m udp --dport 53 -m state --state NEW,ESTABLISHED -j ACCEPT
 
Old 01-15-2018, 05:25 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,976

Rep: Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678
How is your network configured? Physical/virtual? Is the client directly connected to your server or is it connected to the LAN?
If all computers are on your LAN then make sure you turn off the DHCP server in your router.
Is your server's ethernet adapter configured with a static IP address?

By default Ubuntu uses ufw.

sudo ufw allow bootps (DHCP)
sudo ufw allow 53 (DNS)
 
Old 01-15-2018, 05:30 PM   #7
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Original Poster
Rep: Reputation: Disabled
It's physical. It is directly connected to the server.
Both NICs are set to static IPs.
 
Old 01-15-2018, 05:36 PM   #8
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Original Poster
Rep: Reputation: Disabled
I noticed /etc/resolv.conf on the server only has 127.0.0.1 nameserver record. Is this the issue?
 
Old 01-15-2018, 05:44 PM   #9
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,976

Rep: Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678
Quote:
Both NICs are set to static IPs.
I assume this is the server?

Are you trying to configure the server for NAT ie router?

You also need enable IP forwarding and add a masquerade rule.

That is the server using dnsmasq running as a DNS proxy. Should be ok.

Last edited by michaelk; 01-15-2018 at 05:46 PM.
 
Old 01-15-2018, 05:45 PM   #10
ferrari
LQ Guru
 
Registered: Sep 2003
Location: Auckland, NZ
Distribution: openSUSE Leap
Posts: 5,734

Rep: Reputation: 1126Reputation: 1126Reputation: 1126Reputation: 1126Reputation: 1126Reputation: 1126Reputation: 1126Reputation: 1126Reputation: 1126
Quote:
I noticed /etc/resolv.conf on the server only has 127.0.0.1 nameserver record. Is this the issue?
That's as it should be for the server, since dnsmasq is doing the resolving and listening to localhost. You should be able to resolve by hostname on the server. For example
Code:
ping yahoo.com
Focus on the client(s).
 
Old 01-15-2018, 05:50 PM   #11
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
I assume this is the server?

Are you trying to configure the server for NAT ie router?

You also need enable IP forwarding and add a masquerade rule.

That is the server using dnsmasq running as a DNS proxy. Should be ok.
Yes.
I believe I put a iptable NAT rule in place. Would that interfere with this? And yes, this server does the routing. IP forwarding has been enabled, as well as masquerading.
 
Old 01-15-2018, 06:14 PM   #12
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,976

Rep: Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678
Did you configure a gateway in the dnsmasq.conf file?

dhcp-option=3,192.168.1.x (i.e. the p1p1 IP address)
 
Old 01-15-2018, 06:20 PM   #13
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Original Poster
Rep: Reputation: Disabled
I had not. I updated that, restarted the service, but it's still not working.

update: the resolv.conf on the client now has a entry for: nameserver 192.168.1.1 (still not resolving google.com though)

Last edited by sniper8752; 01-15-2018 at 06:25 PM.
 
Old 01-15-2018, 06:40 PM   #14
michaelk
Moderator
 
Registered: Aug 2002
Posts: 24,976

Rep: Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678Reputation: 5678
Can you ping any ip addresses
google.com 74.125.198.139
 
Old 01-15-2018, 06:50 PM   #15
sniper8752
Member
 
Registered: Oct 2012
Posts: 562

Original Poster
Rep: Reputation: Disabled
I can ping the ip but not the hostname.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Do I need dnsmasq? rng Linux - General 7 05-17-2013 04:17 AM
dnsmasq harinathreddy.c Linux - Software 2 11-03-2012 01:46 AM
Dnsmasq imas Linux - Newbie 2 04-13-2012 07:12 AM
DNSMASQ anyone? Help! JeffC1 Linux - Software 3 03-31-2009 11:23 AM
Dnsmasq dunkyb Linux - Software 0 03-16-2003 03:25 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 01:30 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration