changing default port problem

This forum is for admins who are looking to build or expand their OpenVPN setup.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Forum rules
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
Post Reply
bardiya3
OpenVpn Newbie
Posts: 6
Joined: Thu Jan 30, 2020 2:01 pm

changing default port problem

Post by bardiya3 » Thu Jan 30, 2020 2:17 pm

hi
im trying to change openvpn default port from 1194 to 8080

i change port 1194 to port 8080 on server.conf at server and change the client config file like that remote 15.15.15.15 8080
then i restart openvpn but does not worked

i also use this code for opening the port 8080 on firewalld

Code: Select all

firewall-cmd --zone=public --add-port=8070/udp --permanent
firewall-cmd --zone=public --add-port=8070/tcp --permanent


but still connection doesn't work :( :( :( :( [/b]

please help me what can i do for change default port?
i use centos7 os.
Last edited by Pippin on Tue Feb 04, 2020 2:02 pm, edited 1 time in total.
Reason: Removed CAPS, please do not shout!

bardiya3
OpenVpn Newbie
Posts: 6
Joined: Thu Jan 30, 2020 2:01 pm

Re: changing default port problem

Post by bardiya3 » Fri Jan 31, 2020 10:28 pm

but when i change the port to 1194 agine openvpn works agine good!!

if otherwise the server.conf (port 1194) i had to change any option or file which thats not works or not?? please help me what can i do for to change default port?
Last edited by Pippin on Tue Feb 04, 2020 2:01 pm, edited 1 time in total.
Reason: Removed CAPS, please do not shout!

chilinux
OpenVPN Power User
Posts: 156
Joined: Thu Mar 28, 2013 8:31 am

Re: changing default port problem

Post by chilinux » Tue Feb 04, 2020 2:57 am

Are you trying to open up port 8080 or 8070? The firewalld commands you provided seem to indicate you opened 8070 in the firewall instead of 8080.

If you are using OpenVPN Access Server, you should try changing the port via the web interface instead of trying to modify the server.conf directly.

Can you try running the following command and post the resulting output?

Code: Select all

rpm -qi openvpn-as

TiTex
OpenVPN Super User
Posts: 310
Joined: Tue Apr 12, 2011 6:22 am

Re: changing default port problem

Post by TiTex » Tue Feb 04, 2020 12:15 pm

SELinux is probably in the way when using a RHEL based distribution like Fedora, CentOS
you can check the current ports allowed for openvpn process using this command

Code: Select all

semanage port -l | grep openvpn_port_t
add a new (custom) port to that list

Code: Select all

semanage port -a -t openvpn_port_t -p tcp  8080
and of course you need to allow that port through the firewall as well :)

User avatar
Pippin
Forum Team
Posts: 1201
Joined: Wed Jul 01, 2015 8:03 am
Location: irc://irc.libera.chat:6697/openvpn

Re: changing default port problem

Post by Pippin » Tue Feb 04, 2020 2:04 pm

Is this about OpenVPN Access Server or Community version?
I gloomily came to the ironic conclusion that if you take a highly intelligent person and give them the best possible, elite education, then you will most likely wind up with an academic who is completely impervious to reality.
Halton Arp

bardiya3
OpenVpn Newbie
Posts: 6
Joined: Thu Jan 30, 2020 2:01 pm

Re: changing default port problem

Post by bardiya3 » Wed Feb 05, 2020 6:41 pm

chilinux wrote:
Tue Feb 04, 2020 2:57 am
Are you trying to open up port 8080 or 8070? The firewalld commands you provided seem to indicate you opened 8070 in the firewall instead of 8080.

If you are using OpenVPN Access Server, you should try changing the port via the web interface instead of trying to modify the server.conf directly.

Can you try running the following command and post the resulting output?

Code: Select all

rpm -qi openvpn-as
i open up 8080 and another time open up 8070 and i'm sure that I applied the firewall settings correctly
i cant change port with modify server.conf and add rule to firewall that's not work for me
Image
Last edited by Pippin on Wed Feb 05, 2020 6:49 pm, edited 1 time in total.
Reason: Removed CAPS

User avatar
Pippin
Forum Team
Posts: 1201
Joined: Wed Jul 01, 2015 8:03 am
Location: irc://irc.libera.chat:6697/openvpn

Re: changing default port problem

Post by Pippin » Wed Feb 05, 2020 6:47 pm

Topic moved and there is no need for CAPS!
I gloomily came to the ironic conclusion that if you take a highly intelligent person and give them the best possible, elite education, then you will most likely wind up with an academic who is completely impervious to reality.
Halton Arp

bardiya3
OpenVpn Newbie
Posts: 6
Joined: Thu Jan 30, 2020 2:01 pm

Re: changing default port problem

Post by bardiya3 » Wed Feb 05, 2020 8:42 pm

TiTex wrote:
Tue Feb 04, 2020 12:15 pm
SELinux is probably in the way when using a RHEL based distribution like Fedora, CentOS
you can check the current ports allowed for openvpn process using this command

Code: Select all

semanage port -l | grep openvpn_port_t
add a new (custom) port to that list

Code: Select all

semanage port -a -t openvpn_port_t -p tcp  8080
and of course you need to allow that port through the firewall as well :)
i do it but still not works!!!!
just when i back the port to 1194 works :cry: :cry: :cry:
Image

and when i want to use port 8080 i encounter this error
Image

bardiya3
OpenVpn Newbie
Posts: 6
Joined: Thu Jan 30, 2020 2:01 pm

Re: changing default port problem

Post by bardiya3 » Wed Feb 05, 2020 8:45 pm

Pippin wrote:
Wed Feb 05, 2020 6:47 pm
Topic moved and there is no need for CAPS!
please instead of moving help us for fix the problem :(

bardiya3
OpenVpn Newbie
Posts: 6
Joined: Thu Jan 30, 2020 2:01 pm

Re: changing default port problem

Post by bardiya3 » Sun Feb 09, 2020 3:08 pm

no one cant help me ????? :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry: :cry:

chilinux
OpenVPN Power User
Posts: 156
Joined: Thu Mar 28, 2013 8:31 am

Re: changing default port problem

Post by chilinux » Tue Feb 11, 2020 2:48 am

The reason your post was moved is you placed it in the forum for OpenVPN Access Server. Since you are running OpenVPN as compiled by the EPEL project instead of OpenVPN AS, the advice you would get about OpenVPN AS would probably just frustrate you further.

SElinux policy support is usually best provided by the OS distribution. As you can see from the files listed by the installed RPM, OpenVPN doesn't itself provide any SElinux policy.

The problem appears from what you posted to be that a policy type is already squatting on the port you want to assign.

Have you tried modifying the existing entry such as the following:

Code: Select all

semanage port -m -t openvpn_port_t -p tcp 8080
Otherwise, try deleting the existing entry before adding it such as:

Code: Select all

semanage port -d -p tcp 8080
semanage port -a -t openvpn_port_t -p tcp 8080

Post Reply