How To Set Up an OpenVPN Server on Ubuntu 14.04
How To Set Up an OpenVPN Server on Ubuntu 14.04
If you're looking to set up a secure VPN server on Ubuntu 14.04, OpenVPN is a great option. This tutorial will walk you through the process of installing and configuring OpenVPN on your Ubuntu 14.04 server.
Step 1: Install OpenVPN
The first step is to install OpenVPN on your Ubuntu 14.04 server. You can do this by running the following command:
sudo apt-get install openvpn
Step 2: Generate Server Certificates and Keys
Next, you'll need to generate the server certificates and keys. OpenVPN comes with a script that simplifies this process:
cd /usr/share/doc/openvpn/examples/easy-rsa/2.0/
source vars
./clean-all
./build-ca
./build-key-server server
./build-dh
Step 3: Configure OpenVPN
After generating the server certificates and keys, you'll need to configure OpenVPN. Create a new configuration file with the following command:
sudo nano /etc/openvpn/server.conf
Copy and paste the following configuration into the file:
port 1194
proto udp
dev tun
ca /etc/openvpn/keys/ca.crt
cert /etc/openvpn/keys/server.crt
key /etc/openvpn/keys/server.key
dh /etc/openvpn/keys/dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
Save and exit the file.
Step 4: Enable IP Forwarding
Before you start the OpenVPN service, you'll need to enable IP forwarding on your Ubuntu 14.04 server. To do this, open the /etc/sysctl.conf file with the following command:
sudo nano /etc/sysctl.conf
Uncomment the following line:
net.ipv4.ip_forward=1
Save and exit the file.
Next, run the following command to apply the changes:
sudo sysctl -p
Step 5: Start OpenVPN
Finally, start the OpenVPN service with the following command:
sudo service openvpn start
You can check the status of the service with the following command:
sudo service openvpn status
Your OpenVPN server is now up and running!
Комментарии
Отправить комментарий