- I create a server on AWS with OpenVPN.
- Set it up, through the Admin page, I choose fully routing option and download the .ovpn
I add three extra lines to client .ovpn; (I have to use it because ssh freeze problem)
redirect-gateway def1 up /etc/openvpn/update-resolv-conf down /etc/openvpn/update-resolv-conf
This is the client file;
setenv FORWARD_COMPATIBLE 1
client
server-poll-timeout 4
nobind
remote SERVER IP 1194 udp
remote SERVER IP 1194 udp
remote SERVER IP 443 tcp
remote SERVER IP 1194 udp
remote SERVER IP 1194 udp
remote SERVER IP 1194 udp
remote SERVER IP 1194 udp
remote SERVER IP 1194 udp
dev tun
redirect-gateway def1
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
dev-type tun
ns-cert-type server
setenv opt tls-version-min 1.0 or-highest
reneg-sec 604800
sndbuf 0
rcvbuf 0
auth-user-pass auth.txt
# NOTE: LZO commands are pushed by the Access Server at connect time.
# NOTE: The below line doesn't disable LZO.
comp-lzo no
verb 3
setenv PUSH_PEER_INFO
I try client .ovpn with Tunnelblick, enable the full routing and connect without any problem. The things starts get funny when I try to use this VPN on my Ubuntu server.(terminal only)
When I try to use the VPN on my Ubuntu server, first I do;
sudo ip rule add from $(ip route get 1 | grep -Po '(?<=src )(\S+)') table 128
sudo ip route add table 128 to $(ip route get 1 | grep -Po '(?<=src )(\S+)')/32 dev $(ip -4 route ls | grep default | grep -Po '(?<=dev )(\S+)')
sudo ip route add table 128 default via $(ip -4 route ls | grep default | grep -Po '(?<=via )(\S+)')
And then I start running the VPN;
screen -dmS openvpn
screen -S openvpn -X stuff 'sudo openvpn --config client.ovpn --script-security 2'$(echo -ne '\015')
Funny thing is when I curl ifconfig.co
or try to do anything that requires internet, I can't because something is wrong with routing.
This used to work but it does not anymore for some reason. I'm open to any suggestions.
Update
Problem is somewhere around the routing table. This is my normal routing table without connecting to VPN;
and this is after I connect to VPN;
aaand this is if I don't fully route, which routing tables are in order and internet works fine;