LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-20-2018, 09:45 AM   #16
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174

I do not find dnsmasq referenced in anything in /etc/systemctd. As to the other file you referred to
Code:
root@taylor21:/etc/network# cat interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback
That is all that is there - but dnsmasq is in fact running. I suspect that NetworkManager is the guilty party. Per the NM home page states
Quote:
The NetworkManager daemon attempts to make networking configuration and operation as painless and automatic as possible by managing the primary network connection and other network interfaces, like Ethernet, WiFi, and Mobile Broadband devices.
To achieve that goal it should be able to:

1 - obtain an IP address from the upstream connection by DHCP (this works)
2 - assign IP addresses to devices connected to the "Shared to other computers" interface (I do not know if this works - I have a new test in mind)
3 - allow devices which have been assigned addresses per #2 above to ping each other by device/host name (this does NOT work)

I think for my next trick I will bark up NetworkManager's tree and see if I can make it do these things rather than try to interact with whatever components it uses to do the magic.

Or I will assign manual/static IP addresses to my dozen physical devices and use /etc/hosts for LAN DNS. I am sort of doing that now anyway. I have reserved addresses in my dhcpd server for my physical devices. dhcpd really only serves virtual machines running on my workstation.

Ken
 
Old 04-20-2018, 09:54 AM   #17
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
"interfaces" sources /etc/network/interfaces.d. Did you look in the sourced directory?

Last edited by MensaWater; 04-20-2018 at 09:55 AM.
 
Old 04-21-2018, 08:14 AM   #18
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
The referenced directory is empty. But it gets worse...

I re-imaged the SD card in the Pi to a state before I started messing with networking. I booted the Pi and observed that it had an IP address of 192.168.0.100 assigned to the one Ethernet interface. This is coming from the router to which it is connected and is as expected. I plugged in the USB to Internet dongle and connected its Ethernet port to a switch. Using the NetworkManager applet I configured it as "Shared to other computers." It obtained an IP address 10.42.0.1 as per my prior experience. I plugged two PCs into the switch. Both obtained Ip addresses in the 10.42.0.xxx range and could ping each other by name!

This is wonderful except that I have NO control over what is happening. Specifically I cannot change the sub-net upon which the shared connection operates, nor can I control the range of addresses served by the DHCP function.

I again re-imaged the Pi and removed the second NIC. I connected the first NIC to my "real" network which uses dhcpd (I think, more about that in a moment). I booted the Pi and it obtained an address in the 10.42.0.xxx range as expected. I connected the USB to Ethenet dongle and configured as above. AGAIN it gained an address 10.42.0.1. This will NOT work as that is the address of the dhcpd server.

I examined the dhcpd server and it is also running dnsmasq.
Code:
[root@taylor16 etc]# ps aux | grep dnsmasq
nobody     864  0.0  0.0  15580  1300 ?        S    08:28   0:00 /usr/sbin/dnsmasq --conf-file --no-hosts --keep-in-foreground --bind-interfaces --except-interface=lo --clear-on-reload --strict-order --listen-address=10.42.0.1 --dhcp-range=10.42.0.10,10.42.0.254,60m --dhcp-option=option:router,10.42.0.1 --dhcp-lease-max=50 --pid-file=/var/run/nm-dnsmasq-enp0s20u1.pid --conf-dir=/etc/NetworkManager/dnsmasq-shared.d
root      3077  0.0  0.0 112664   980 pts/1    S+   08:53   0:00 grep --color=auto dnsmasq
I note here that the address range conflicts with what I have configured in dhpcd.conf (10.42.100-10.42.0.200). My physical devices have reserved addresses in dhcpd.conf and I do not have enough virtual machines at the moment to determine which dhcp server is serving.

I did determine that dnsmasq has taken upon itself a role in passing DNS requests to the Internet. When I did a killall of dnsmasq on this box I lost connection to the Internet from my LAN.

As to it's config directory
Quote:
--conf-dir=/etc/NetworkManager/dnsmasq-shared.d
empty.

I think NetworkManager must have been written by Microsoft If works "perfectly" provided "perfectly" is the author's definition of perfect. Seriously, I DO appreciate the hard work of the NetworkManager developers to take the hard work out of setting up a simple network. Still... when I need to make one little change...

I see that there is a NetworkManager mailing list. Let me have a try there and see what I can find out. Arch and Gentoo also have NetworkManager pages. Sometimes these distros provide some useful tips. Gentoo says
Quote:
Important
NetworkManager and other network management services typically do not work together. That includes a standalone instances of dhcpcd and Gentoo's default netifrc scripts. Be sure only one network management service is running at a time. Adding more than one network management service will lead to unpredictable results!
Ken
 
Old 04-21-2018, 10:30 PM   #19
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
If it's starting when a networking cable is plugged in, then dnsmasq starting is probably triggered by the ifup/ifdown scripts. Or more likely by dbus these days.

$ apt-file list dnsmasq
Code:
dnsmasq: /etc/default/dnsmasq
dnsmasq: /etc/dnsmasq.conf
dnsmasq: /etc/dnsmasq.d/README
dnsmasq: /etc/init.d/dnsmasq
dnsmasq: /etc/insserv.conf.d/dnsmasq
dnsmasq: /etc/resolvconf/update.d/dnsmasq
dnsmasq: /lib/systemd/system/dnsmasq.service
dnsmasq: /usr/lib/resolvconf/dpkg-event.d/dnsmasq
dnsmasq: /usr/share/dnsmasq/installed-marker
dnsmasq: /usr/share/doc/dnsmasq
$ apt-file list dnsmasq-base
Code:
dnsmasq-base: /etc/dbus-1/system.d/dnsmasq.conf
dnsmasq-base: /usr/sbin/dnsmasq
dnsmasq-base: /usr/share/dnsmasq-base/trust-anchors.conf
dnsmasq-base: /usr/share/doc/dnsmasq-base/DBus-interface.gz
dnsmasq-base: /usr/share/doc/dnsmasq-base/FAQ.gz
dnsmasq-base: /usr/share/doc/dnsmasq-base/README.Debian
dnsmasq-base: /usr/share/doc/dnsmasq-base/changelog.Debian.gz
dnsmasq-base: /usr/share/doc/dnsmasq-base/changelog.archive.gz
dnsmasq-base: /usr/share/doc/dnsmasq-base/changelog.gz
dnsmasq-base: /usr/share/doc/dnsmasq-base/copyright
dnsmasq-base: /usr/share/doc/dnsmasq-base/doc.html
dnsmasq-base: /usr/share/doc/dnsmasq-base/examples/dnsmasq.conf.example
dnsmasq-base: /usr/share/doc/dnsmasq-base/setup.html
dnsmasq-base: /usr/share/locale/de/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/es/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/fi/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/fr/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/id/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/it/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/no/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/pl/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/pt_BR/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/locale/ro/LC_MESSAGES/dnsmasq.mo
dnsmasq-base: /usr/share/man/es/man8/dnsmasq.8.gz
dnsmasq-base: /usr/share/man/fr/man8/dnsmasq.8.gz
dnsmasq-base: /usr/share/man/man8/dnsmasq.8.gz
As far as DNS goes, dnsmasq primarily does DNS caching. So you don't have to do re-lookup's. The names that it knows are via the dns servers (normally specified /etc/resolv.conf). You can hard code resolutions in /etc/hosts. Or you can setup the router as the primary DNS lookup and have it hand out associated names. In the case of DHCP your IP can be dynamic, so hard coding it in /etc/hosts is a bit ill advised. Although a router can be setup to hand out the same IP depending on the MAC address. All of which is more of a router and DHCP-server things, not dnsmasq.

$ less /usr/share/doc/dnsmasq/README.Debian

$ less /usr/share/doc/dnsmasq-base/README.Debian

Not that you need dhcp, dnsmasq, and such. You can hard code everything. Which is pretty much how I still do things. But I don't manage anything other than my local router(dd-wrt), an sbc that acts as my ethernet to wifi bridge, and a half dozen linux devices in proximity of the bridge sbc with a micro ethernet switch attached to expand it's 1 port into 4 available ports. It's simpler (for me) than setting up wifi on many devices with sometimes quirky or non-existent wifi drivers in linux. Plus less radiation so I glow less at night.
 
Old 04-22-2018, 08:59 AM   #20
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
Thanks Shadow_7 for the apt-file tip. I had gotten away from Ubuntu back at 9.10/10.04. 10.04 would not support my dual display setup and I moved to CentOS for the most part.

You have a valid point about manual addresses and hard coding.

For my latest experiment...

Re-imaged and booted the Pi connected to the router (no upstream connection on the router just to be sure)
Pi got address 192.168.0.101 - OK
Plugged in the dongle and set it to Shared to other computers
The dongle NIC got the address 10.42.0.1 - OK
Plugged test machine PC15 to the switch fed by the dongls
PC15 got the address 10.42.0.208 - OK but I want a different address
Configured PC15 to have a manual address 10.42.0.15
Plugged test machine PC13 into the switch
It was assigned 10.42.0.133 - OK

On PC15 "ping PC13" resolves and works
On PC13 "ping PC15 resolves to 10.42.0.208 which of course does not work

dnsmasq is running with the parameters --cache-size=0 and --clear-on-reload. It should NOT be caching DNS (I think) and a reboot of the Pi SHOULD clear anything it did cache. A reboot of the Pi and it still thinks PC15 is at 10.42.0.208.

Finally - even though PC15 can ping PC13 by host name, the Pi can NOT ping PC13 by host name - even though the Pi issued the address to PC13.

I only have a dozen devices. Time to create a master /etc/hosts file, copy it to each device and set all of the addresses manually.

Ken

p.s. I asked the questions on the network-manager mailing list. If some miraculous advice is forthcoming I will update this thread for posterity.
 
Old 04-24-2018, 09:55 AM   #21
taylorkh
Senior Member
 
Registered: Jul 2006
Location: North Carolina
Distribution: CentOS 6, CentOS 7 (with Mate), Ubuntu 16.04 Mate
Posts: 2,127

Original Poster
Rep: Reputation: 174Reputation: 174
I received a reply on the NetworkManager mailing list. Handling "reserved" IP addresses with NetworkManager/dnsmasq was said to be "very difficult" unlike with dhcpd which was very simple. As to where the configuration of the subnet is... a few more suggestions of look here or there.

Bottom line - I have gone on to plan B.

All of my physical devices now have manually set addresses
I have a master /etc/hosts file which I have distributed to all devices
I have replaced my CentOS 7 router/firewall/dhcp/vpn sharing etc. server with a Raspberry Pi 3B+. I let it assume the address 10.42.0.1 which is the default for a "Shared to other computers" interface. This is the same address as the CentOS server had but it is a simple swap out. Works great and only draws a couple of Watts!

Thanks again to all who offered suggestions.

Ken
 
  


Reply



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
[SOLVED] dnsmasq not reading ethers file keymoo Linux - Newbie 2 09-27-2013 12:22 AM
Trouble with rsyslog config to filter dnsmasq-log-spam Yalla-One Linux - Server 2 01-04-2013 12:35 AM
dnsmasq.lease file + description of its contents vlrk Linux - Server 2 09-22-2011 07:45 AM
is there a file where dnsmasq stores its cached dns? kublador Linux - Software 0 09-04-2004 07:01 AM
dnsmasq cleaning up leases file TheRealDeal Linux - Networking 0 03-02-2004 11:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:31 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