Masquerade on FreeBSD
Generic babbling
In modern world many backends are just a few golang lines running on AWS Lambda. Developers more and more seldom realize the magic behind computer screen and don't know what to do if there is a network outage.
Once in a while I get my hands on a computer with some free resources and I like to build and maintain computer networks. My latest acquisition is Samsung R700, an Intel Core 2 Duo computer from 2009 I got as a present.
It is a pity that most of these machines get left behind. That is why we can find a new application for this machine and get to know how to configure a FreeBSD router running OpenVPN and DNS.
Setup DNS
In order to make the computer act as DNS server we need to configure the server.
Usually it's two choices: isc-dhcp-server or dnsmasq. I started with
the former back in days, but now I switched more to the latter, as it was
included by default with some Linux and I find the syntax generally more
concise. The instructions in this document are written on BSD system,
but all of it should generally apply to Linux distributions, as these
systems are quite similar if you are just starting out with them.
Let's start with setting up Dnsmasq on BSD. It will act as the DHCP server
providing IP addresses for client computers. We can do it with famous pkg tool:
pkg install dnsmasq
Now it's about time to start the openvpn service. Configuration of services in BSD
is done through /etc/rc.conf. Let's add the following line there:
dnsmasq_enable="YES"
Now, we want some hosts on our network to always receive the same IP address. We will define it in configuration file for Dnsmasq.
This is how you enable all other services in BSD systems. Next, it's time to create keys and configure clients. You will read about this in part 2...
welw