Skip to content

Instantly share code, notes, and snippets.

@gusano
Created April 6, 2017 20:15
Show Gist options
  • Save gusano/13316591a66c3dcc4156f8b68c4f153b to your computer and use it in GitHub Desktop.
Save gusano/13316591a66c3dcc4156f8b68c4f153b to your computer and use it in GitHub Desktop.
Making archlinux use DNS Masq for whatever reason

Login and become root:

sudo su -

Update your stuff (maybe? I dunno whatevs)

pacman -Syu

Install DNSMASQ otherwise, wtf?

pacman -S dnsmasq

make a directory

mkdir /etc/dnsmasq.d 

add that directory to dnsmasq's config FOR NARNIA!

echo 'conf-dir=/etc/dnsmasq.d,.bak' >> /etc/dnsmasq.conf 

Make a domain file because reasons... so with the editor of your choice add the following to this file: /etc/dnsmasq.d/lan.bib:

bogus-priv
local=/bib/
listen-address=127.0.0.1
expand-hosts
domain=easybib.bib

Now delete that old nasty resolv.conf file (it was a symlink on my system

rm /etc/resolv.conf

And with your fave editor add this to the /etc/resolv.conf file:

nameserver 127.0.0.1
nameserver 4.2.2.1
nameserver 8.8.8.8

Feel free to add your own nameservers or whatever. Maybe you should have looked at what resolve.conf said before you deleted it? Perhaps.

Now, if you're using DHCP it prolly is what is overwriting the resolv.conf file every 2.375 uSeconds. So add nohook resolv.conf to /etc/dhcpcd.conf with your fave editor.

And finally make that stuf start up:

systemctl enable dnsmasq
systemctl start dnsmasq

You likely don't need to reboot at this point but whatev's

So at this point if you add a host to your /etc/hosts file like the following:

10.20.30.1	poop.bib

it'll resolve with ping/dig/et.al. AFTER you do this systemctl start dnsmasq

but you know it's a good way to test... add a domain.bib to the hosts file... dig it (dig domain.bib) and watch it fail then do systemctl start dnsmasq and dig it again... poof it werks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment