os 13.1 - DNSMASQ - DNS SERVER and DHCP SERVER config - small local network

Hello.
After reading some posts on the forum, I try to configure a dns server and a dhcp server.
Here is my dnsmasq.conf file on the server :

domain-needed
bogus-priv
interface=srv_eth0
expand-hosts
domain=my-dom-test.nwk,192.168.130.0/24
dhcp-range=192.168.130.65,192.168.130.145,16h
dhcp-host=00:24:1d:c1:99:ba,192.168.130.100,LINUX-TEST-123
dhcp-host=00:26:2d:62:64:90,192.168.130.70,NOTEPAD-ACER
dhcp-host=60:a4:4c:7d:b9:28,192.168.130.80,NOTEPAD-ASUS
dhcp-host=00:1b:24:56:f1:36,192.168.130.90,NOTEPAD-HP
dhcp-host=00:1b:a9:3c:be:76,192.168.130.103,BROTHER-HL2150N
dhcp-host=00:15:99:8a:a0:19,192.168.130.104,SAMSUNG-CLP325W

The server has good ip adress : 192.168.130.100 but pick from cache :
here log :

§TIME§ Oct 19 22:12:12,§PR§ 5,§FCLTY§ 1,§HOST§ LINUX-TEST-123, §TAG§  ifup-dhcp[1360]:, §MSG§  { Starting DHCP4 client on srv_eth0} 

§TIME§ Oct 19 22:12:12,§PR§ 6,§FCLTY§ 16,§HOST§ LINUX-TEST-123, §TAG§  dhcpcd[1823]:, §MSG§  { srv_eth0: dhcpcd 3.2.3 starting} 

§TIME§ Oct 19 22:12:12,§PR§ 6,§FCLTY§ 16,§HOST§ LINUX-TEST-123, §TAG§  dhcpcd[1823]:, §MSG§  { srv_eth0: hardware address = 00:24:1d:c1:99:ba} 

§TIME§ Oct 19 22:12:12,§PR§ 6,§FCLTY§ 16,§HOST§ LINUX-TEST-123, §TAG§  dhcpcd[1823]:, §MSG§  { srv_eth0: broadcasting for a lease} 

§TIME§ Oct 19 22:12:32,§PR§ 3,§FCLTY§ 16,§HOST§ LINUX-TEST-123, §TAG§  dhcpcd[1823]:, §MSG§  { srv_eth0: timed out} 

§TIME§ Oct 19 22:12:32,§PR§ 6,§FCLTY§ 16,§HOST§ LINUX-TEST-123, §TAG§  dhcpcd[1823]:, §MSG§  { srv_eth0: trying to use old lease in `/var/lib/dhcpcd/dhcpcd-srv_eth0.info'} 

§TIME§ Oct 19 22:12:32,§PR§ 6,§FCLTY§ 16,§HOST§ LINUX-TEST-123, §TAG§  dhcpcd[1823]:, §MSG§  { srv_eth0: adding IP address 192.168.130.100/24} 

§TIME§ Oct 19 22:12:32,§PR§ 5,§FCLTY§ 1,§HOST§ LINUX-TEST-123, §TAG§  ifup-dhcp[1360]:, §MSG§  {} 

§TIME§ Oct 19 22:12:32,§PR§ 5,§FCLTY§ 1,§HOST§ LINUX-TEST-123, §TAG§  ifup-dhcp[1360]:, §MSG§  {     srv_eth0  DHCP4 continues in background} 

§TIME§ Oct 19 22:12:33,§PR§ 6,§FCLTY§ 3,§HOST§ LINUX-TEST-123, §TAG§  dnsmasq-dhcp[2770]:, §MSG§  { DHCP, IP range 192.168.130.65 -- 192.168.130.145, lease time 16h} 

§TIME§ Oct 19 22:12:34,§PR§ 6,§FCLTY§ 16,§HOST§ LINUX-TEST-123, §TAG§  dhcpcd[1823]:, §MSG§  { srv_eth0: exiting} 

here ifconfig from server

LINUX-TEST-123:~ # ifconfig
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:484 errors:0 dropped:0 overruns:0 frame:0
          TX packets:484 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:47937 (46.8 Kb)  TX bytes:47937 (46.8 Kb)

srv_eth0  Link encap:Ethernet  HWaddr 00:24:1D:C1:99:BA  
          inet addr:192.168.130.100  Bcast:192.168.130.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5348 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4500 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4206192 (4.0 Mb)  TX bytes:595925 (581.9 Kb)

LINUX-TEST-123:~ # 

Other host (NOTEPAD-ASUS) on the network does not get ip adress.
I have remove the cache on this host.
Here ifconfig :

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:484 errors:0 dropped:0 overruns:0 frame:0
          TX packets:484 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:47937 (46.8 Kb)  TX bytes:47937 (46.8 Kb)

ass_eth0  Link encap:Ethernet  HWaddr 60:A4:4C:7D:B9:28  
          inet addr:192.168.130.100  Bcast:192.168.130.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5348 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4500 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:4206192 (4.0 Mb)  TX bytes:595925 (581.9 Kb)


Resolv.conf for the server :

search lan
nameserver 127.0.0.1
nameserver 192.168.2.200

Resolv.conf for the host :

search lan
nameserver 192.168.2.200

First,
Some basic understanding what DNS and DHCP does for your network…

  • DHCP provides automatic IP address allocation and data for network clients in your network. When hosts boot up on the network, if they aren’t configured with a static address, they issue a broadcast which hopefully is answered by a DHCP Server. If a DHCP server receives a broadcast DHCP request, an IP address is issued for that MAC address plus some optional additional information (like Default Gateway, routers, DNS servers, more)

  • DNS provides centralized name resoution on your network. DNS maps hostnames (preferably “fully qualified”) to IP addresses which is superior to using broadcasts and distributing hosts files.

So, given the above,

  • Although you haven’t progressed to testing DNS, DNSmasq is unnecessary and could be a problem for the scenario you describe. Uninstall or disable it with the following command
systemctl disable dnsmasq
  • Your errors are about obtaining a valid IP address, which of course must be successful before anything networking can be done including testing for DNS name resolution.

So, some elementary DHCP troubleshooting might start with

  • Verify the service is running
systemctl status dhcpd.service
  • Inspect your Firewall, your network interface should be assigned to the <internal> zone (not external which is default) and for good measure the DHCP service should be listed as a permitted service (As long as you’re checking this for DHCP, verify the DNS service is permitted as well).

If you made any changes, in general a system reboot likely is desirable (although stop/restarting services might also work).
Of course, this assumes you correctly configured the data served for DHCP and DNS.

HTH,
TSU

My starting stage :
My dsl modem-router acting as dhcp server with pre-reserved ip adress for 3 linux computer (One of them to become a linux server), one windows computer and 2 printers.
At this moment, every computers get their own reserved ip adress, have access to internet, can connect thru ssh to each other.
Then on one computer I have configured dnsmasq as shown before, enable dsnmasq service. I have disabled dhcp server on the dsl modem-router. And restart every things.
I have modified only one computer by adding the dnsmasq config script. That’s all.
[LEFT]I thought that dnsmasq did all the job. And it was enough to create a config /etc/dnsmasq.conf file.
If not, what to do more ? configure a dhcp server and configure dns server using yast2. BUt in this case what dnsmasq is supposed to do ?
If I enable again the dhcp server functionnality on the dsl modem-router every return to the starting point.
So it seems that I have to configure the dhcp server functionality on the linux server ?

[/LEFT]

Recommend understanding what dnsmasq is first
http://en.wikipedia.org/wiki/Dnsmasq

You need to decide whether to run dnsmasq <or> a traditional setup running all network services separately. Personally, I have always opted for setting up individual services, it’s how I learned the stuff. But, you can choose to use dnsmasq instead.

If you follow my instructions, you’ll setup separate apps for DNS and DHCP, but if you choose to setup dnsmasq instead, then you should not do this, you should setup only dnsmasq.

If you disable or uninstall the dhcp server app on your openSUSE, you will still need to open ports UDP 67 and 68 in your firewall, or otherwise enable the services in your SUSE FW.

General SOP for initial testing network services of any type

  • Verify the service is running, and there isn’t some kind of app contention in this case (only one app should provide the service). So depending on the apps/service a “systemctl status service” or YAST are good places to verify or configure a service, and if there are problems usually these types of errors are logged to the system log.
  • Verify the specified port on the network interface is open in the FW.
  • Test using a remote client
  • If the remote client fails, then optionally test using a client on the same machine as the Server providing the service
  • If the client fails, then use Telnet (or similar app) to probe the port for a response

TSU

Nothing knew :

Dnsmasq is a lightweight server designed to provide DNS, DHCP and TFTP services to a small-scale network. It can serve the names of local machines which are not in the global DNS. The DHCP server integrates with the DNS server and allows machines with DHCP-allocated addresses to appear in the DNS with names configured either in each host or in a central configuration file. Dnsmasq supports static and dynamic DHCP leases and BOOTP for network booting of diskless machines.

It is exactly what I am trying to configure. Using dnsmasq as a DNS and DHCP server. So in good english one can forgot yast2 dns server configuration step and yast2 dhcp server configuration.

My purpose at the moment is to make dnsmasq working as it should be easier.
I may be wrong, but in what I read, it appears that configuring /etc/dnsmaq.conf is sufficient.

So I need help using that way.

Maybe someone else has more experience manipulating dnsmasq.

The only places I’ve used it is when it’s embedded within an application, like a virtualization technology… And I’ve never had to configure dnsmasq directly in those cases, just use libvirt vm manager.

When I set up a network with multiple physical machines, setting up the regular DHCP and DNS have been pretty easy so I haven’t looked for other solutions.

But as a starting point,
Have you disabled or uninstalled DHCP and DNS? As noted, those provide duplicate services so should not be running when you use dnsmasq.

TSU

SOLVE.

On the server :

1-) Have removed dhcp server and dns server

zypper rm -t pattern dhcp_dns_server

Have removed all config files relative dhcp and dns

2-) Have configured the network card with yast2

  • Untick : change default route by dhcp
  • Statically assigned address
  • Set default route to gateway on the subnet
  • Untick : change hostname by dhcp

3-) Have use standard config in /etc/dnsmasq.conf

# Configuration file for dnsmasq.
#
#
# If Command line : Run in foreground for debug mode : -d
#
strict-order
bogus-priv
domain-needed
no-hosts
#
# set the gateway to 192.168.130.230
#    --> syntax 1 [dhcp-option=3,192.168.130.230]
#    --> syntax 2 [dhcp-option=option:router,192.168.130.230]
dhcp-option=option:router,192.168.130.230
#
# The conf-file option is also allowed in configuration files,
# to include multiple configuration files
#conf-file=
#
interface=srv_eth0
listen-address=192.168.130.234
#
domain=my-dom-test.nwk,192.168.130.0/24
#
# PUBLIC DNS
#
server=8.8.8.8
server=8.8.4.4
#
expand-hosts
#
dhcp-leasefile=/var/lib/misc/dnsmasq.leases
dhcp-lease-max=50
#
dhcp-range=192.168.130.65,192.168.130.99,16h
#NOTEPAD
dhcp-host=40:26:2d:62:64:90,PORTABLE-ACER
dhcp-host=60:a4:4c:7d:b9:28,PORTABLE-ASUS
dhcp-host=33:1b:24:56:f1:36,PORTABLE-HP
# PRINTER
dhcp-host=00:1b:a9:3c:be:76,192.168.130.103,BROTHER-HL2150N
dhcp-host=00:15:99:8a:a0:19,192.168.130.104,SAMSUNG-CLP325W
#
#
dhcp-no-override
# LOGS
log-queries
log-dhcp

Cool.
Thx for posting your complete solution.

TSU

On 2014-10-20 17:06, tsu2 wrote:
>
> Recommend understanding what dnsmasq is first
> http://en.wikipedia.org/wiki/Dnsmasq

dnsmasq(8):

dnsmasq - A lightweight DHCP and caching DNS server.

Yes, dnsmasq does it both things.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

The problem was not what dnsmasq can do, the problem was to make it doing the job after an initial install with dhcp server and dns server installed files. I have to removed every things from the dhcp_dns_server pattern. I had not thought at the time.

On 2014-10-28 12:36, jcdole wrote:

> The problem was not what dnsmasq can do, the problem was to make it
> doing the job after an initial install with dhcp server and dns server
> installed files. I have to removed every things from the dhcp_dns_server
> pattern. I had not thought at the time.

Yes, I read about that later, and I saved your post for future reference.


Cheers / Saludos,

Carlos E. R.
(from 13.1 x86_64 “Bottle” at Telcontar)

[LEFT]Some additional information
If you use additional configuration files by the way of options (for example
resolv-file=/etc/resolv.dnsmasq.conf

or conf-file=/etc/dnsmasq.more.conf

or conf-dir=/etc/dnsmasq.d
…)
You must open Apparmor configuration using Yast.
Then Edit the profile ‘/usr/sbin/dnsmasq’ and then each files or directories must be set to r/w/x in accordance with the actions envisaged for dnsmasq.
Otherwise you will get a message like :“Dnsmasq unable to read files …” and then dnsmasq may failed to start.

[/LEFT]