My setup currently is an Ubuntu 20.04 server running docker with an OpenVPN server inside a container, specifically this one.
Running with the default config:
server 192.168.255.0 255.255.255.0
verb 3
key /etc/openvpn/pki/private/ip.key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/ip.crt
dh /etc/openvpn/pki/dh.pem
tls-auth /etc/openvpn/pki/ta.key
key-direction 0
keepalive 10 60
persist-key
persist-tun
proto udp
# Rely on Docker to do port mapping, internally always 1194
port 1194
dev tun0
status /tmp/openvpn-status.log
user nobody
group nogroup
comp-lzo no
### Route Configurations Below
#route 192.168.254.0 255.255.255.0
### Push Configurations Below
push "block-outside-dns"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "comp-lzo no"
allows me to connect to the VPN and to the internet just fine. However I went to change the IP pool since the network I will be connecting from is 192.168.0.0/16
and there will be potential IP clashes.
I changed the config to:
server 10.255.0.0 255.255.255.0 # The only line that has changed
verb 3
key /etc/openvpn/pki/private/ip.key
ca /etc/openvpn/pki/ca.crt
cert /etc/openvpn/pki/issued/ip.crt
dh /etc/openvpn/pki/dh.pem
tls-auth /etc/openvpn/pki/ta.key
key-direction 0
keepalive 10 60
persist-key
persist-tun
proto udp
# Rely on Docker to do port mapping, internally always 1194
port 1194
dev tun0
status /tmp/openvpn-status.log
user nobody
group nogroup
comp-lzo no
### Route Configurations Below
#route 192.168.254.0 255.255.255.0
### Push Configurations Below
push "block-outside-dns"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
push "comp-lzo no"
but I can no longer connect to the internet. I can ping the gateway that the server creates, but trying to visit something like https://ipinfo.io doesn't work.
I have tried https://serverfault.com/questions/761857/changing-openvpn-dhcp-pool#761976 to no avail.
I don't know how to use the route
option in the config and nothing I have read so far seems to have worked since I'm not trying to access machines behind the server, I'm just trying to get internet access.
Does anyone know what I might be missing here or anything that I need to add? Thanks.
EDIT: Below are the routing tables for the client device. Before connecting:
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eno1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eno1
192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eno1
After connecting (with '10.' configuration server side):
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 10.255.0.5 0.0.0.0 UG 0 0 0 tun0
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eno1
10.255.0.1 10.255.0.5 255.255.255.255 UGH 0 0 0 tun0
10.255.0.5 0.0.0.0 255.255.255.255 UH 0 0 0 tun0
92.11.250.195 192.168.0.1 255.255.255.255 UGH 0 0 0 eno1
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eno1
192.168.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eno1
192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 eno1