Openvpn changing IP address when reconnected with RDP
-
Hi, thats my first post and im a newbie on pfsense openvpn so here's my situation:
Installed a new client for openvpn service with pfsense 2.6.0 version so he can work through home office via RPD. I did the configs and stuff, he can connect from his house to the local server from his main work but when we connect him with RDP the IP address from his main server keeps changing, difficulting the access off RDP. Please, does anyone have some suggestions? sorry for my bad english.
-
if you use dhcp on lan, the ip adress can change. please check firstly openvpn server settings ipv4 tunnel adress. it must be differen to your dhcp range.
after then set a static ip for your local server. you can do it on
services > dhcp server > lan tab > scroll down and click "+", find your server mac adress and write there, also find an empty ip adress from your dhcp range and write there again.
but i don't understand whats that mean "the IP address from his main server" can you define it? is it public ip adress or servers local ip adress?
-
@greenlight thanks for the answer!
Just tried this:
*@greenlight said in Openvpn changing IP address when reconnected with RDP:
services > dhcp server > lan tab > scroll down and click "+", find your server mac adress and write there, also find an empty ip adress from your dhcp range and write there again.*
But when i wrote my clients local server IP on IP Address field there is this alert:
"The following input errors were detected:
The IP address must lie in the LAN subnet."
Answering your last question: im trying to connect one of my clients off his laptop home straight to his local server from his office with RDP.
The issue here is the connect off the RDP is made with IP address, but, when the OpenVPN client from his local server is reconnected the IP from OpenVPN keeps changing (10.200.200.4 > reconnect > 10.200.200.5 > reconnect > 10.200.200.6, etc...)
I placed an RDP file on his desktop area to ease the connection with the local server IP (10.200.200.5) but if openvpn keeps chaning the IP when reconnected my cliente will not be able to connect to the local server by himself. Neither from "mstsc.exe" win command. Also, my client have a MikroTik RB750 .
please let me know if this made sense. as i told before: im a newbie on it lol
-
@cezar_a openvpn and dhcp pools must be different.
also in the lan tab, you just can define your dhcp range. if your dhcp pool like 1.1.1.1-1.1.1.254 just you can use an ip address between it.
and your openvpn tunnel adress must be 1.1.2.0/24
check your openvpn tunnel adresses on there
vpn > openvpn > click e on the end of the line > scroll down and look for tunnel setting > "IPv4 Tunnel Network" check that network adress pool.
-
@cezar_a openvpn and dhcp pools must be different.
right, just did that. OpenVPN ipv4 tunnel now is 1.1.2.0/24 and IP Address form Lan tab now is 192.168.105.100. Restarted openvpn client server, IP range now is on range as the ipv4 tunnel but IP address keep changing in a crescent order every time theres is a reconnection (my customer's local power grid is failing daily, complicating even more the situation) Did i miss something that would fix my local server IP as static?
-
@cezar_a do you connect with router or client export ?
-
@greenlight client export, theres a mikrotik RB on my clients local server. his home got a simple router.
-
@cezar_a If the changed IP address belongs to the local server, if you change with static ip, it will be fix.
I thought that the IP address that changed in your previous article belonged to the OpenVPN client.
If you can send your dhcp server information as a screenshot, I can help you with this. Of course, you also need to provide an unused IP address.
-
@greenlight thanks for your help, greenlight. It means a lot. Heres my dhcp server information for my clients local server:
the question here is that openvpn IP to this server (1.1.2.2), when initialized comes with this address and the RDP connection works fine and when theres a recconection the IP goes to 1.1.2.3 > reconnect > 1.1.2.4 and it goes on.
-
@cezar_a
Not really easy to unterstand, what you're complaining. I think, you mean the virtual IP out of the OpenVPN tunnel pool, which the client gets assigned changes on the re-connection.
And now you are looking for a way to assign a static IP to the client?Assuming your OpenVPN server is configured with SSL/TLS authentication, you can do this with a client specific override. You can find this tab in the OpenVPN section.
Add a new one, at "Common Name" enter the CN which you used in the client certificate and state an IP within the tunnel network in CIDR notation. E.g. you tunnel network is 1.1.2.0/24, so enter 1.1.2.100/24 for the client.
Then he should always get 1.1.2.100, when connecting to the server. -
@viragomann it worked like a charm. Now the local server and my clients notebook now works successfully with a static IP on OpenVPN tunnels. Thank you so much and thanks to @greenlight for the help.
-
@cezar_a your welcome