iw4p / OpenConnect-Cisco-AnyConnect-VPN-Server-OneKey-ocserv

[Script and Docker 🐳] OpenConnect (Cisco AnyConnect) VPN Server (OCServ) script one key easy configurator and installer
255 stars 133 forks source link

After a couple of days, traffic is not going through the vpn server #22

Closed ber-serker closed 1 year ago

ber-serker commented 1 year ago

So when I run the script on my server, everything is fine for 2 or 3 days. But after that, my IP address doesn't change when I connect to the server. It seems like the traffic is not going through the VPN server and something is wrong with the routing. I compared the logs from the first and last day. No differences.

iw4p commented 1 year ago

Did you restart the ocserv from sysctl (if you are not using docker, if you are using docker just restart your container)? What about uninstalling an installing?

ber-serker commented 1 year ago

I restarted the ocserv service but nothing happened. I reinstalled it and it just works for two days and the same problem appeares.

iw4p commented 1 year ago

So you installed ocserv via script? Can you try Docker?

ber-serker commented 1 year ago

I will keep you posted on the docker method's result. Thanks for the immediate response.

iw4p commented 1 year ago

You're welcome!

ber-serker commented 1 year ago

I installed the docker. The connection works for two minutes but it gets disconnected. It doesn't last more than two minutes.

iw4p commented 1 year ago

Therefore, we can conclude that the important factor is ocserv.conf. Because the Dockerfile uses different ocserv.conf than the script. I suggest you to check this out and change ocserv.conf parameters, and recreate your docker container with new ocserv.conf.

ber-serker commented 1 year ago

I changed some options in ocserv.conf. The problem is when I reboot the server, docker is not functioning in the way it was before the reboot. I get this error. Error response from daemon: Container d0c9975a3d7edc1c46946b80733c595804cedc21e478bf153aa84ede3151da9e is not running And vpn is not connecting anymore. I tried to start the docker and nothing happened. Actually, I'm not the docker expert but after restarting the server, you need some knowledge about dockers to run that service again.

iw4p commented 1 year ago

Yes actually you need to know some of the basic commands of Docker. Git clone the whole project into a directory. Then try to build an image with Dockerfile (search build docker image from dockerfile). Then after you make your image from the Dockerfile, you need to make a container from it, so search for create docker container from an image. After that you can create and run it. Each time you modify the ocserv.conf file in the project directory, you need to build the docker file and run it again.

Don't forget to docker rmi (remove instance). It's important to remove your previous running docker container and then start a new one, because of port conflicts.