0

After I connect my Linux machines to my Ubuntu 16.04 VPN server on AWS ec2 instance, I loose internet connection but can ping VPN server.

server conf:

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key
dh dh2048.pem
topology subnet
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
client-config-dir ccd
route 10.8.0.0 255.255.255.252
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
client-to-client
keepalive 10 120
tls-auth ta.key 0 # This file is secret
key-direction 0
cipher AES-128-CBC   # AES
auth SHA256
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3

client config:

client
dev tun
proto udp
remote myserver 1194
resolv-retry infinite
nobind
user nobody
group nogroup
persist-key
persist-tun
remote-cert-tls server
cipher AES-128-CBC
auth SHA256
key-direction 1
comp-lzo
verb 3
Cerificates...

ccd/client:

ifconfig-push 10.8.0.26 255.255.255.0

route -n when connected to vpn:

route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.8.0.1        128.0.0.0       UG    0      0        0 tun0
0.0.0.0         172.29.25.1     0.0.0.0         UG    100    0        0 eth0
10.8.0.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0
vpnserverIP   172.29.25.1     255.255.255.255 UGH   0      0        0 eth0
128.0.0.0       10.8.0.1        128.0.0.0       UG    0      0        0 tun0
172.29.25.0     0.0.0.0         255.255.255.0   U     100    0        0 eth0

ifconfig tun0:

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1500
    inet 10.8.0.26  netmask 255.255.255.0  destination 10.8.0.26
    inet6 fe80::c922:ab77:1b0c:5095  prefixlen 64  scopeid 0x20<link>
    unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 100  (UNSPEC)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 1039  bytes 129116 (126.0 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
6
  • Which machine loses internet connection? The VPN server or the client? Jul 13, 2017 at 23:29
  • You have to allow IP-forwarding on your Server and package forwarding and masquerading in your Server's Firewall... this tutorial helped me pretty much
    – derHugo
    Jul 14, 2017 at 5:22
  • (section 8, if you use another firewall you have to transfer the rules or directly use iptables)
    – derHugo
    Jul 14, 2017 at 5:28
  • Client losses internet but can ping VPN server; derHugo, i used exact the same article ) went through and made sure every step is followed. I tried to disable ufw still nothing. Does resolv.conf has anything to do with it? ~# cat /etc/resolv.conf # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8) # DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN nameserver 172.31.0.2 search us-east-2.compute.internal
    – Russ
    Jul 14, 2017 at 18:07
  • <blink>-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE</blink> #is in my before.rules <br>My server: <br>route -n <br>Kernel IP routing table <br>Destination Gateway Genmask Flags Metric Ref Use I<br>face <br>0.0.0.0 172.31.16.1 0.0.0.0 UG 0 0 0 eth0 <br>10.8.0.0 10.8.0.2 255.255.255.252 UG 0 0 0 tun0 <br>10.8.0.0 0.0.0.0 255.255.255.0 U 0 0 0 tun0172.31.16.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0
    – Russ
    Jul 14, 2017 at 18:14

1 Answer 1

0

Finaly found a solution when settings my pi as a wifi router, i knew there was firewall problem, so this lines solved traffic issues:

-A POSTROUTING -s 10.8.0.0/16 -o eth0 -j MASQUERADE -A FORWARD -i eth0 -o tun0 -m state --state RELATED,ESTABLISHED -j ACCEPT -A FORWARD -i tun0 -o eth0 -j ACCEPT

if using ufw transfer this rules accordingly!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .