How to Fix OpenVPN Socket Bind Failure

I recently came up with this error on one of my OpenVPN servers.

"OpenVPN - Socket bind failed on local address [AF_INET] IP:#portnum: Cannot assign requested address"

Let me share how I did fix it.
First off, check this openvpn’s default init script : [email protected]

1sudo grep After /usr/lib/systemd/system/openvpn\@.service

It will look like this: After=network.target
Well, change it like this:

1After=network-online.target

Reboot the server, if the connection is still not working after rebooting, change the selinux configuration.

1cd /etc/selinux/
2# youmayknowwhattodo

Reboot again, then it should be working.
Enjoy networking! 🙂

comments powered by Disqus