<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Subash</title>
    <description>The latest articles on DEV Community by Subash (@banjadesubash).</description>
    <link>https://dev.to/banjadesubash</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1241906%2F5d006cec-3c4b-4dd9-b000-f66e4a41c80a.png</url>
      <title>DEV Community: Subash</title>
      <link>https://dev.to/banjadesubash</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/banjadesubash"/>
    <language>en</language>
    <item>
      <title>CONFIGURE VPN TO ACCESS INSTANCES IN THE PRIVATE NETWORK</title>
      <dc:creator>Subash</dc:creator>
      <pubDate>Mon, 01 Jan 2024 15:57:55 +0000</pubDate>
      <link>https://dev.to/aws-builders/configure-vpn-to-access-instances-in-the-private-network-cp5</link>
      <guid>https://dev.to/aws-builders/configure-vpn-to-access-instances-in-the-private-network-cp5</guid>
      <description>&lt;h2&gt;
  
  
  Launching EC2 and installing OpenVPN
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Launch an EC2 instance(public) in a VPC to setup openVPN(Ubuntu is taken in this lab)&lt;/li&gt;
&lt;li&gt;Connect to the EC2 instance through SSH then update and upgrade the instance using:
&lt;code&gt;sudo apt update
sudo apt upgrade&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Install openVPN server in the public subnet and run the OpenVPN installer wizard using following commands:
&lt;code&gt;wget https://git.io/vpn -O openvpn-ubuntu-install.sh
chmod -v +x openvpn-ubuntu-install.sh
sudo&amp;nbsp;./openvpn-ubuntu-install.sh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;In the wizard, provide choices as shown in fig. Then, provide a client name&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--V3U9eGDZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/10ki752aby5kvvtboizt.png" alt="Installation Wizard" width="800" height="422"&gt;
&lt;/li&gt;
&lt;li&gt;Check the status of openVPN server:
&lt;code&gt;sudo systemctl status openvpn-server@server.service&lt;/code&gt;
If a restart is needed:
&lt;code&gt;sudo systemctl restart openvpn-server@server.service&lt;/code&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Bj6Byy3L--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/manyz9phnrwbj0x248ra.png" alt="OpenVPN service status" width="800" height="447"&gt;
&lt;/li&gt;
&lt;li&gt;Download the&amp;nbsp;.ovpn file to local pc. It is required to connect through openVPN desktop client. The name of the&amp;nbsp;.ovpn file depends on the name of the client provided during the previous wizard installation.
&lt;code&gt;ssh -i "your-key.pem" ubuntu@&amp;lt;public ip address&amp;gt; "sudo -S cat /home/ubuntu/client_name.ovpn" &amp;gt; client_name.ovpn&lt;/code&gt;
The directory for the&amp;nbsp;.ovpn file could differ&amp;nbsp;: /root/&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--j_Va4oMk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lzm7h0sjm0buoxkddqdz.png" alt="openVPN profile download" width="800" height="53"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Configuring Security&amp;nbsp;groups
&lt;/h3&gt;

&lt;p&gt;The default port 1194 was selected in the wizard previously. So, the inbound rules should include Custom UDP for port 1194.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--WSofEwH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/papbabts2p2qjfvy5bfs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WSofEwH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/papbabts2p2qjfvy5bfs.png" alt="Inbound Rules" width="800" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Downloading OpenVPN Connect and establishing the connection
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://openvpn.net/client-connect-vpn-for-windows/"&gt;https://openvpn.net/client-connect-vpn-for-windows/&lt;/a&gt; (Windows)&lt;/li&gt;
&lt;li&gt;After the installation is completed, run the application and import the&amp;nbsp;.ovpn file.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3A-h56n9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1rolj3evsn7hmbw5fyri.png" alt="IOpenVPN Client Console" width="399" height="511"&gt;
&lt;/li&gt;
&lt;li&gt;The imported profile details is shown.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BNv55epd--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/uwsm340cg7fgcghavfkp.png" alt="VPN Profile" width="397" height="688"&gt;
&lt;/li&gt;
&lt;li&gt;If all the configurations are proper, the connection will be successful.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--waf9QLZg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/awdmpl1x74vw0i36lawd.png" alt="OpenVPN connectuion" width="401" height="684"&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Verifying the connection to the instance in private&amp;nbsp;subnet
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Once the openVPN connection is successful, we can verify whether the instances in the private subnet can be connected to or not.&lt;/li&gt;
&lt;li&gt;Launch an instance in a private subnet for the same VPC as of the instance in the public subnet.
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nBAdtLIq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f7r1bog94dfs86l7r44c.png" alt="EC2 console" width="800" height="333"&gt;
&lt;/li&gt;
&lt;li&gt;Take the private IPv4 address and PEM file and connect through SSH
&lt;code&gt;ssh -i "&amp;lt;pem-file&amp;gt;" ubuntu@&amp;lt;private-ip&amp;gt;&lt;/code&gt;
&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dLPVSFBC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/h0zgt051v8tozky5xndu.png" alt="EC2 ssh connection" width="800" height="666"&gt;
&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>aws</category>
      <category>ec2</category>
      <category>vpc</category>
      <category>vpn</category>
    </item>
  </channel>
</rss>
