welw

Masquerade in FreeBSD Parte 3 or feel like home even when you're not

Imagine the following scenario: You have built your dream network and you are very often away from home. You want to access the data on your local area network. You built your services on your development machines and you wish to be able to develop and access these machines even when you are sitting on a train, or you are in a hotel preparing very last lines of code and fine polishing your presentation for your client.

How to: Enable VPN clients to talk to computers on LAN

For routing packets from clients to and from FreeBSD server we will use PF - Packet Filter and OpenVPN. PF is a firewall built in BSD systems and OpenVPN is a VPN server. PF will take care of data packets from the Internet and between computers on the local network. OpenVPN will create a network interface on both FreeBSD server and Clients, usually tun0. This network interface will behave like a network card, meaning packets can go in and out, but they are on different networks.

Before OpenVPN was installed, we had the following network cards in the computer: - msk0 for wired interface with services on the net (Nextcloud, WWW, Samba) - msk1 for connecting to the Internet

After OpenVPN is installed, we will even see a tun0 device where all clients connected to the vpn are available.

To be continued...