Hi,
I recently got a VPS and i followed [url=https://ubuntu.com/server/docs/service-openvpn]Ubuntu's openVPN guide[/url] to set up a openVPN server on it.
I've manage to successfully communicate with the VPS via the openVPN service. My Windows computer is given an IP address and i can ping the VPS (10.8.0.1) through the tunnel.
I want to route my computer internet traffic through the tunnel. I believe routing all traffic through the tunnel should be the easiest to achieve? I know there are issues with this like my computer not being able to communicate with the DHCP whilst i'm connected, so once i achieved the easiest as a proof of concept, i want to spit the traffic so that only internet trafffic goes through the VPN and/or only for particular URIs.
I've read a lot of forum posts of others asking a similar question but i don't seem to be making any progress.
Plenty of forum posts suggest:
- Adding "redirect-gateway def1" to the configuration files on both sides.
- Adding push "remote-gateway vpn_server_ip" to the server configuration file.
- Excuting the command "iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE" on the server
It feels like i'm missing something since others report doing the same has worked for them. May someone highlight what i've missed please?
On my computer i do have another VPN application installed for a VPN i pay for. I've had the VPN not connected throughout trying to get openVPN to work. Could it be interferring?
ipconfig gives the following:
Unknown adapter OpenVPN TAP-Windows6:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 10.8.0.6
Subnet Mask . . . . . . . . . . . : 255.255.255.252
Default Gateway . . . . . . . . . :
Below are the configurations.
I've changed the openVPN server IP address from it's real IP address to 1.2.3.4.
[b]----- Server Configuration -----[/b]
port 3300
proto udp
dev tun
ca ca.crt
cert TestServer1.crt
key TestServer1.key # This file should be kept secret
dh dh.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist /var/log/openvpn/ipp.txt
push "redirect-gateway def1"
push "remote-gateway 10.8.0.1" # or should this be 1.2.3.4
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
keepalive 10 120
tls-auth ta.key 0 # This file is secret
cipher AES-256-CBC
persist-key
persist-tun
status /var/log/openvpn/openvpn-status.log
verb 3
explicit-exit-notify 1
;local a.b.c.d
;port 1194
;proto tcp
;dev tap
;dev-node MyTap
;dh dh2048.pem
;topology subnet
;server-bridge 10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100
;server-bridge
;push "route 192.168.10.0 255.255.255.0"
;push "route 192.168.20.0 255.255.255.0"
;client-config-dir ccd
;route 192.168.40.128 255.255.255.248
;client-config-dir ccd
;route 10.9.0.0 255.255.255.252
;learn-address ./script
;push "redirect-gateway def1 bypass-dhcp"
;client-to-client
;duplicate-cn
;compress lz4-v2
;push "compress lz4-v2"
;comp-lzo
;max-clients 100
;user nobody
;group nogroup
;log /var/log/openvpn/openvpn.log
;log-append /var/log/openvpn/openvpn.log
;mute 20
[b]----- Client Configuration -----[/b]
client
dev tun
proto udp
remote 1.2.3.4 3300
resolv-retry infinite
nobind
persist-key
persist-tun
ca "C:\\Temp\\ca.crt"
cert "C:\\Temp\\Computer.crt"
key "C:\\Temp\\Computer.key"
remote-cert-tls server
tls-auth "C:\\Temp\\ta.key" 1
cipher AES-256-CBC
verb 3
redirect-gateway def1
;dev tap
;dev-node MyTap
;proto tcp
;remote my-server-2 1194
;remote-random
;user nobody
;group nobody
;http-proxy-retry # retry on connection failures
;http-proxy [proxy server] [proxy port #]
;mute-replay-warnings
;mute 20
Struggling to route internet traffic through the tunnel
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.
Please use the [oconf] BB tag for openvpn Configurations. See viewtopic.php?f=30&t=21589 for an example.
-
- OpenVpn Newbie
- Posts: 1
- Joined: Sun Aug 08, 2021 10:49 pm