{"id":5027,"date":"2013-10-18T10:58:53","date_gmt":"2013-10-18T18:58:53","guid":{"rendered":"http:\/\/www.chesnok.com\/daily\/?p=5027"},"modified":"2013-10-19T06:45:53","modified_gmt":"2013-10-19T14:45:53","slug":"vpn-problems-and-ubuntu-killing-off-the-dnsmasq-zombie","status":"publish","type":"post","link":"https:\/\/www.chesnok.com\/daily\/2013\/10\/18\/vpn-problems-and-ubuntu-killing-off-the-dnsmasq-zombie\/","title":{"rendered":"VPN Problems and Ubuntu: killing off the dnsmasq zombie"},"content":{"rendered":"<p>I&#8217;ve been having problems with VPN, DNS and Ubuntu for a year. But, I&#8217;m also pretty lazy when it comes to spending time on configuration. And configuring VPNs is like last on my list of ways I&#8217;d like to spend my time.<\/p>\n<p>In short, I&#8217;d rather reboot than figure out exactly why my networking just stopped working.<\/p>\n<p><a href=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/TurningitOffandOnAgain1.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/TurningitOffandOnAgain1.jpg\" alt=\"REBOOT.\" width=\"300\" height=\"239\" class=\"aligncenter size-full wp-image-5038\" \/><\/a><\/p>\n<p>Fortunately, I had an easy (for me) work-around for most of my VPN needs: use SSH and a jump-host for getting to servers. I found it annoying when I wanted to look at a website on protected network space, or had a service on an unusual port that I wanted to test things against. I would work around with SSH tunnels, or I would fire up my Mac, whose VPN settings worked flawlessly.<\/p>\n<p>That all said, I thought today, a sunny, lovely fall day in Portland, I would fix my VPN.<\/p>\n<p>And so, my buddy @<a href=\"http:\/\/twitter.com\/uberj_\">uberj_<\/a> helped me get things sorted.<\/p>\n<p>The root cause of all my VPN heartache was the <code>dnsmasq<\/code> daemon controlling my DNS. And, related, <code>network-manager<\/code>. There are a few places that document exactly how to disable <code>dnsmasq<\/code><\/p>\n<ul>\n<li>DNS in Ubuntu 12.04 http:\/\/www.stgraber.org\/2012\/02\/24\/dns-in-ubuntu-12-04\/<\/li>\n<li>Disabling dnsmasq as your local DNS server in Ubuntu http:\/\/mark.orbum.net\/2012\/05\/14\/disabling-dnsmasq-as-your-local-dns-server-in-ubuntu\/<\/li>\n<\/ul>\n<p>However, they leave out one important step: killing off the existing dnsmasq process. For the unlucky, restarting <code>network-manager<\/code> does not kill off <code>dnsmasq<\/code>.<\/p>\n<p>So, to find and kill dnsmasq, do the following:<\/p>\n<pre><code> sudo service network-manager stop\n kill `ps -C dnsmasq -o pid=`\n sudo service network-manager start\n<\/code><\/pre>\n<p>Then, start your VPN and check out the contents of the <code>\/etc\/resolv.conf<\/code>. If all went well, you&#8217;ve got nameserver addresses other than <code>127.0.0.1<\/code> in the file.<\/p>\n<p><a href=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/7512696366_76be236667.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/7512696366_76be236667-300x226.jpg\" alt=\"Yay!\" width=\"300\" height=\"226\" class=\"aligncenter size-medium wp-image-5032\" srcset=\"https:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/7512696366_76be236667-300x226.jpg 300w, https:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/7512696366_76be236667.jpg 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>Sadly, this was not the end of my story.<\/p>\n<p>After a few minutes, NetworkManager started <code>dnsmasq<\/code> up again!<\/p>\n<p><a href=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/Animated-Zombie-Reverse.gif\"><img decoding=\"async\" src=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/Animated-Zombie-Reverse.gif\" alt=\"Zombie dnsmasq\" class=\"aligncenter size-medium wp-image-5034\" \/><\/a><\/p>\n<p>So, like any reasonable sysadmin, I opened up the <code>\/etc\/NetworkManager\/NetworkManager.conf<\/code> file, uncommented the <code>dns=dnsmasq<\/code> line, and replaced it with <code>dns=\/dev\/null<\/code>. My guess was that you can probably put just about anything other than dnsmasq into that line to permanently disable the plugin.<\/p>\n<p>I ran <code>sudo service network-manager restart<\/code>, checked <code>\/etc\/resolv.conf<\/code> and felt pretty smug.<\/p>\n<p>I tried also uninstalling <code>dnsmasq-base<\/code> package, but unfortunately that takes out a number of other packages I appear to need. So, I left \/dev\/null in my NetworkManager.conf, and updated this blog post.<\/p>\n<p><a href=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/h5AC86B91.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/h5AC86B91-300x225.jpeg\" alt=\"But wait...\" width=\"300\" height=\"225\" class=\"aligncenter size-medium wp-image-5030\" srcset=\"https:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/h5AC86B91-300x225.jpeg 300w, https:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/h5AC86B91.jpeg 500w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>While editing this blog post, <code>dnsmasq<\/code> took over my DNS settings again.<\/p>\n<p>A clue as to what was happening was in <code>\/var\/log\/syslog<\/code>:<\/p>\n<pre><code>Oct 18 10:20:10 localhost dnsmasq[30535]: started, version 2.59 cache disabled\nOct 18 10:20:10 localhost dnsmasq[30535]: compile time options: IPv6 GNU-getopt DBus i18n DHCP TFTP conntrack IDN\nOct 18 10:20:10 localhost dnsmasq[30535]: DBus support enabled: connected to system bus\nOct 18 10:20:10 localhost dnsmasq[30535]: warning: no upstream servers configured\n<\/code><\/pre>\n<p>It turns out that <code>dnsmasq<\/code> was still getting revived by <code>NetworkManager<\/code>. Why NetworkManager doesn&#8217;t seem to care about configuration settings was beyond my willingness to investigate today. So, I did some more searching about truly killing of dnsmasq for good.<\/p>\n<p>And I found <a href=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/7512696366_76be236667.jpg\">this thread<\/a>, and <a href=\"http:\/\/www.thekelleys.org.uk\/dnsmasq\/docs\/dnsmasq.conf.example\">this sample configuration file<\/a>. In the output for the <code>dnsmasq<\/code> process from ps:<\/p>\n<pre><code>nobody   30777 30759  0 10:21 ?        00:00:00 \/usr\/sbin\/dnsmasq --no-resolv --keep-in-foreground --no-hosts --bind-interfaces --pid-file=\/var\/run\/sendsigs.omit.d\/network-manager.dnsmasq.pid --listen-address=127.0.0.1 --conf-file=\/var\/run\/nm-dns-dnsmasq.conf --cache-size=0 --proxy-dnssec --enable-dbus --conf-dir=\/etc\/NetworkManager\/dnsmasq.d\n<\/code><\/pre>\n<p>I dug into the thread, and the suggestion was to set <code>port=0<\/code> in the config. I created a file called <code>custom<\/code> in <code>\/etc\/NetworkManager\/dnsmasq.d<\/code>. And ran <code>sudo service network-manager restart<\/code>.<\/p>\n<p>And then I got this in my syslog:<\/p>\n<pre><code>Oct 18 10:21:10 localhost dnsmasq[30777]: started, version 2.59 DNS disabled\n<\/code><\/pre>\n<p>FINALLY.<\/p>\n<p><a href=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/yes-finally-pl-ffffff.jpeg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/yes-finally-pl-ffffff-252x300.jpeg\" alt=\"FINALLY!\" width=\"252\" height=\"300\" class=\"aligncenter size-medium wp-image-5036\" srcset=\"https:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/yes-finally-pl-ffffff-252x300.jpeg 252w, https:\/\/www.chesnok.com\/daily\/wp-content\/uploads\/2013\/10\/yes-finally-pl-ffffff.jpeg 418w\" sizes=\"auto, (max-width: 252px) 100vw, 252px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been having problems with VPN, DNS and Ubuntu for a year. But, I&#8217;m also pretty lazy when it comes to spending time on configuration. And configuring VPNs is like last on my list of ways I&#8217;d like to spend &hellip; <a href=\"https:\/\/www.chesnok.com\/daily\/2013\/10\/18\/vpn-problems-and-ubuntu-killing-off-the-dnsmasq-zombie\/\">Continue reading &rarr;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[146],"tags":[],"class_list":["post-5027","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/posts\/5027","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/comments?post=5027"}],"version-history":[{"count":10,"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/posts\/5027\/revisions"}],"predecessor-version":[{"id":5044,"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/posts\/5027\/revisions\/5044"}],"wp:attachment":[{"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/media?parent=5027"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/categories?post=5027"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.chesnok.com\/daily\/wp-json\/wp\/v2\/tags?post=5027"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}