{"id":8966,"date":"2024-08-26T06:33:21","date_gmt":"2024-08-26T06:33:21","guid":{"rendered":"https:\/\/www.infinitivehost.com\/knowledge-base\/?p=8966"},"modified":"2024-08-30T07:52:36","modified_gmt":"2024-08-30T07:52:36","slug":"allow-openvpn-through-a-port-on-centos-6-5-simple-guide","status":"publish","type":"post","link":"https:\/\/www.infinitivehost.com\/knowledge-base\/allow-openvpn-through-a-port-on-centos-6-5-simple-guide\/","title":{"rendered":"Allow OpenVPN Through a Port on CentOS 6.5: Simple Guide"},"content":{"rendered":"<div class='epvc-post-count'><span class='epvc-eye'><\/span>  <span class=\"epvc-count\"> 1,239<\/span><span class='epvc-label'> Views<\/span><\/div>\n<p>To allow OpenVPN traffic through a specific port on CentOS 6.5, you&#8217;ll need to configure the firewall to permit traffic on the port used by OpenVPN. CentOS 6.5 uses <code>iptables<\/code> for firewall management. Here\u2019s a step-by-step guide on how to do this:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>Determine the Port Used by OpenVPN<\/strong><\/h3>\n\n\n\n<p>First, you need to know which port OpenVPN is using. By default, OpenVPN uses UDP port 1194, but this might vary depending on your configuration.<\/p>\n\n\n\n<p>You can check the OpenVPN configuration file to confirm the port:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open the OpenVPN server configuration file (usually located at <code>\/etc\/openvpn\/server.conf<\/code> or similar):<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">sudo nano \/etc\/openvpn\/server.conf<\/mark><\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Look for the line that specifies the port and protocol:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">port 1194\n  proto udp<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>In this example, OpenVPN is using UDP port 1194.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>Configure <code>iptables<\/code> Rules<\/strong><\/h3>\n\n\n\n<p>You need to add <code>iptables<\/code> rules to allow traffic on the OpenVPN port.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Add Rules for OpenVPN Port<\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open a terminal and use the following commands to allow traffic on the specified port. Replace <code>1194<\/code> with the port number OpenVPN is using if it differs. <strong>For UDP:<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">sudo iptables -A INPUT -p udp --dport 1194 -j ACCEPT<\/mark><\/code><\/code><\/pre>\n\n\n\n<p><strong>For TCP (if OpenVPN is using TCP):<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>  <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">sudo iptables -A INPUT -p tcp --dport 1194 -j ACCEPT<\/mark><\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Ensure that the rule allows traffic from established connections to continue:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  sudo iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Save the <code>iptables<\/code> Rules<\/h4>\n\n\n\n<p>To make sure the changes persist after a reboot, save the <code>iptables<\/code> rules.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>On CentOS 6.x, use the following command to save the rules:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">sudo service iptables save<\/mark><\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>Restart the <code>iptables<\/code> Service<\/strong><\/h3>\n\n\n\n<p>To apply the new rules immediately, restart the <code>iptables<\/code> service:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">sudo service iptables restart<\/mark><\/code><\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>Verify the Firewall Rules<\/strong><\/h3>\n\n\n\n<p>To confirm that your rules have been applied correctly, you can list the current <code>iptables<\/code> rules:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">sudo iptables -L -n -v<\/mark><\/code><\/code><\/pre>\n\n\n\n<p>Look for the rules you added to ensure they are in place.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>Check SELinux Configuration (if applicable)<\/strong><\/h3>\n\n\n\n<p>If SELinux is enabled on your CentOS 6.5 system, it might also be enforcing additional security policies. You might need to adjust SELinux policies to allow OpenVPN traffic.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check the SELinux status:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">getenforce<\/mark><\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If SELinux is enforcing, and you encounter issues, you can temporarily set it to permissive mode for testing:<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>  <code><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-red-color\">sudo setenforce 0<\/mark><\/code><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>If OpenVPN works with SELinux in permissive mode, you may need to adjust SELinux policies to permanently allow OpenVPN traffic.<\/li>\n<\/ul>\n\n\n\n<p>By following these steps, you should be able to allow OpenVPN traffic through the specific port on CentOS 6.5. If you run into issues or need further customization, checking OpenVPN and CentOS documentation might be helpful.<\/p>\n\n\n\n<p><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>To permit OpenVPN traffic with the help of a particular port on CentOS 6.5, then you want to have the firewall to easily permit traffic on the specific port that is used by OpenVPN and have <a href=\"https:\/\/www.infinitivehost.com\/managed-odoo-server-solutions\"><mark style=\"background-color:#8ed1fc\" class=\"has-inline-color\"><strong>managed odoo server solutions<\/strong><\/mark><\/a>. CentOS 6.5 utilizes iptables for management of firewalls.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1,239 Views To allow OpenVPN traffic through a specific port on CentOS 6.5, you&#8217;ll need to configure the firewall to permit traffic on the port used by OpenVPN. CentOS 6.5 uses iptables for firewall management. Here\u2019s a step-by-step guide on how to do this: 1. Determine the Port Used by OpenVPN First, you need to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[203],"tags":[],"class_list":["post-8966","post","type-post","status-publish","format-standard","hentry","category-odoo"],"_links":{"self":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8966","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/comments?post=8966"}],"version-history":[{"count":2,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8966\/revisions"}],"predecessor-version":[{"id":9018,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/posts\/8966\/revisions\/9018"}],"wp:attachment":[{"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/media?parent=8966"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/categories?post=8966"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.infinitivehost.com\/knowledge-base\/wp-json\/wp\/v2\/tags?post=8966"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}