For IT professionals or those dabbling in network administration, the ability to establish secure connections between remote systems is a must. This blog post will guide you through the steps to set up a VPN server and configure RDP for local IPs on a CentOS 7 system.
Setting up the VPN Server
Firstly, you need to install an OpenVPN server. OpenVPN is an open-source VPN software that enables secure point-to-point connections.
- To install OpenVPN and easy-rsa packages, use the following command:
sudo yum install -y openvpn easy-rsa
- After the installation, navigate to the OpenVPN directory and copy the sample configuration file:
cd /etc/openvpn/ sudo cp /usr/share/doc/openvpn-*/sample/sample-config-files/server.conf ./
- You need to make necessary edits to the server.conf file for the proper operation of your VPN. Open the file in your preferred text editor (for example,
vi) and look for the lines starting with “dh”, “ca”, “cert”, and “key”, and ensure they point to the correct locations. Also, uncomment the “push “redirect-gateway def1 bypass-dhcp”” line.
- Restart the OpenVPN service to apply the changes:
sudo systemctl restart openvpn@server
- Make sure OpenVPN starts on boot:
sudo systemctl enable openvpn@server
Now, for your VPN users to resolve domain names correctly, you need to set up a DNS server and push its IP to them.
- Install a DNS server such as BIND:
sudo yum install bind
- Configure the BIND service and set the DNS forwarders to point to your preferred DNS servers.
- In the OpenVPN configuration file, push your DNS server’s IP to the clients:
push "dhcp-option DNS 192.168.1.100"
- Restart the OpenVPN service to apply the changes.
Setting up RDP on Local IPs
For the purpose of RDP connections to local IPs, ensure that the target VMs have RDP enabled. In the case of Windows VMs, you can enable RDP through the system properties settings.
Please note that you need to configure the firewall rules correctly to allow RDP connections over the VPN.
With these settings in place, you will be able to route your internet traffic securely through the VPN, as well as establish RDP connections to your local VMs. Note that your network performance might decrease because all traffic has to be encrypted and routed through the VPN server. It is always important to consider this trade-off when setting up VPN services.
This is a general overview, and the specifics might vary based on your environment and needs. Always make sure to thoroughly test your setup to ensure everything is working as expected.