mirror of
https://github.com/DoTheEvo/selfhosted-apps-docker
synced 2024-11-17 03:25:30 +00:00
update
This commit is contained in:
parent
7a1f6aaf8c
commit
e3a622c174
@ -4,12 +4,22 @@
|
|||||||
|
|
||||||
![logo](https://i.imgur.com/SOa4kRd.png)
|
![logo](https://i.imgur.com/SOa4kRd.png)
|
||||||
|
|
||||||
# Purpose
|
# Purpose & Overview
|
||||||
|
|
||||||
Lightweight DHCP and DNS server.
|
Lightweight DHCP and DNS server.
|
||||||
|
|
||||||
* [Official site](http://www.thekelleys.org.uk/dnsmasq/doc.html)
|
* [Official site](http://www.thekelleys.org.uk/dnsmasq/doc.html)
|
||||||
* [Arch wik](https://wiki.archlinux.org/index.php/dnsmasq)
|
* [Arch wiki](https://wiki.archlinux.org/index.php/dnsmasq)
|
||||||
|
|
||||||
|
dnsmasq solves the problem of accessing self hosted stuff when you are inside
|
||||||
|
your network. As asking googles DNS for `blabla.org` will return your
|
||||||
|
very own public IP and most routers/firewalls wont allow this loopback,
|
||||||
|
where your requests should go out and then right back.</br>
|
||||||
|
Usual quick way to solve this issue is editing the `hosts` file on your machine,
|
||||||
|
but if more devices should "just work" it is a no-go.</br>
|
||||||
|
So the answer is running a DNS server that pairs the local machines IP with
|
||||||
|
the correct hostnames, and a DHCP server that tells the devices on the network
|
||||||
|
to use this DNS.
|
||||||
|
|
||||||
# Files and directory structure
|
# Files and directory structure
|
||||||
|
|
||||||
@ -26,7 +36,8 @@ Lightweight DHCP and DNS server.
|
|||||||
* `hosts` - a file that can provide additional hostname-ip mapping
|
* `hosts` - a file that can provide additional hostname-ip mapping
|
||||||
|
|
||||||
`hosts` and `resolve.conf` are just normal system files always in use on any linux
|
`hosts` and `resolve.conf` are just normal system files always in use on any linux
|
||||||
system.
|
system.</br>
|
||||||
|
`dnsmasq.conf` comes with the dnsmasq installation.
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
@ -67,23 +78,33 @@ address=/plex.blabla.org/192.168.1.3
|
|||||||
|
|
||||||
# DHCP -------------------------------------------------------------------------
|
# DHCP -------------------------------------------------------------------------
|
||||||
|
|
||||||
dhcp-range=192.168.1.51,192.168.1.199,255.255.255.0,480h
|
|
||||||
# gateway
|
|
||||||
dhcp-option=3,192.168.1.1
|
|
||||||
|
|
||||||
dhcp-authoritative
|
dhcp-authoritative
|
||||||
|
dhcp-range=192.168.1.50,192.168.1.200,255.255.255.0,480h
|
||||||
|
# gateway
|
||||||
|
dhcp-option=option:router,192.168.1.1
|
||||||
|
|
||||||
|
# DHCP static IPs --------------------------------------------------------------
|
||||||
|
# mac address : ip address
|
||||||
|
|
||||||
|
dhcp-host=08:00:27:68:f9:bf,192.168.1.150
|
||||||
|
|
||||||
#dhcp-leasefile=/var/lib/misc/dnsmasq.leases
|
#dhcp-leasefile=/var/lib/misc/dnsmasq.leases
|
||||||
```
|
```
|
||||||
|
|
||||||
|
*extra info*
|
||||||
|
|
||||||
|
* `dnsmasq --test` - validates the config
|
||||||
|
* `dnsmasq --help dhcp` - lists all the DHCP options
|
||||||
|
|
||||||
# resolv.conf
|
# resolv.conf
|
||||||
|
|
||||||
Contains DNS nameservers to be used by this linux machine.</br>
|
A file that contains DNS nameservers to be used by the linux machine,
|
||||||
|
specifically its glibc resolver library.</br>
|
||||||
Since dnsmasq, a DNS server, is running right on this machine,
|
Since dnsmasq, a DNS server, is running right on this machine,
|
||||||
the entries should point to localhost.
|
the entries should just point to localhost.
|
||||||
|
|
||||||
Bit of an issue is that this file is often changed by various system services,
|
Bit of an issue is that this file is often managed by various system services,
|
||||||
like systemd or dhcpcd.
|
like dhcpcd, systemd, networkmanager... and they change it as they see fit.</br>
|
||||||
To prevent this, `resolv.conf` will be flagged as immutable,
|
To prevent this, `resolv.conf` will be flagged as immutable,
|
||||||
which prevents all possible changes to it unless the attribute is removed.
|
which prevents all possible changes to it unless the attribute is removed.
|
||||||
|
|
||||||
@ -115,8 +136,10 @@ add immutability, and check.
|
|||||||
|
|
||||||
# /etc/hosts
|
# /etc/hosts
|
||||||
|
|
||||||
dnsmasq reads `/etc/hosts` for IP hostname pairs entries.
|
This is a file present on every system, linux, windows, mac, android,...
|
||||||
This is where you can add hostnames you wish to route to any ip you want.
|
where you can assign a hostname to an IP.</br>
|
||||||
|
dnsmasq reads `/etc/hosts` for IP hostname pairs and adds them to its own
|
||||||
|
resolve records.
|
||||||
|
|
||||||
Unfortunately no wildcard support.
|
Unfortunately no wildcard support.
|
||||||
But as seen in the `dnsmasq.conf` there is a wildcard section solving this,
|
But as seen in the `dnsmasq.conf` there is a wildcard section solving this,
|
||||||
@ -136,16 +159,16 @@ so blabla stuff here is just for show.
|
|||||||
|
|
||||||
# Start the service
|
# Start the service
|
||||||
|
|
||||||
Make sure you disable other DHCP servers on the network beforehand,
|
|
||||||
usually a router is running one.
|
|
||||||
|
|
||||||
`sudo systemctl enable --now dnsmasq`
|
`sudo systemctl enable --now dnsmasq`
|
||||||
|
|
||||||
|
*Make sure you disable other DHCP servers on the network,
|
||||||
|
usually a router is running one.*
|
||||||
|
|
||||||
# Test it
|
# Test it
|
||||||
|
|
||||||
#### DHCP
|
#### DHCP
|
||||||
|
|
||||||
Set some machine to use DHCP for its network setting.</br>
|
Set some machine on the network to use DHCP for its network setting.</br>
|
||||||
It should just work.
|
It should just work.
|
||||||
|
|
||||||
You can check on the dnsmasq host, file `/var/lib/misc/dnsmasq.leases`
|
You can check on the dnsmasq host, file `/var/lib/misc/dnsmasq.leases`
|
||||||
@ -177,4 +200,4 @@ which contains the config files.
|
|||||||
|
|
||||||
#### restore
|
#### restore
|
||||||
|
|
||||||
Replace the config files with the one from backup
|
Replace the content of the config files with the one from the backup.
|
||||||
|
Loading…
Reference in New Issue
Block a user