This is an old revision of the document!
Router configuration
The goal is to configure you home server to act as a router/gateway for your internal network. First of all, make sure your home network is not connected physically to any ISP gateway/router/modem. For security, you want all your traffic to go trough your home server.
The home server will act as DNS server, DHCP server and gateway for your internal network. To achieve this goal i will show you how to use DNSmasq which is a very simple but powerful tool.
Enable a couple of useful use-flags:
> echo net-dns/dnsmasq dhcp-tools dnssec >> /etc/portage/package.use/dnsmasq
dhcp.tools is needed to ensure dnsmasq will support DHCP, while dnssec will be useful to enable dnssec support on the home network.
First of all emerge it:
> emerge dnsmasq
All you actually need to do it create a meaningful configuration file, take this one as example:
- dnsmasq.conf
# Here put your home LAN interface interface=enp0s31f6 # do not resolve your internal DNS names outside domain-needed # Never forward addresses in the non-routed address spaces bogus-priv # Use AdGuard DNS service to filter ads no-resolv no-poll server=94.140.14.14 server=94.140.15.15 # You can add your own ads filters here (for me, AdGuard works good enough) #addn-hosts=/etc/adblock.hosts # DHCP settings for internal network (from 100 to 250, under 100 are fixed ips) dhcp-range=10.0.0.100,10.0.0.250,12h # Send gateway and DNS values to the DHCP clients dhcp-option=option:router,10.00.0.1 dhcp-option=option:dns-server,10.00.0.1 # Preassign fixed IPs via DHCP to specific hosts: #dhcp-host=34:f3:9a:73:a6:a4,10.0.0.99
Well, this is almost all. Start dnsmasq service and make it start on boot:
> rc-update add dnsmasq default > /etc/init.t/dnsmasq start
Now you can connect your devices to the home network and they will get an IP address and a full network configuration to go with it.
Add DNS forced redirection to force all devices to go trough your ad blocker filters