Issues with OpenVPN server accepting connections but not allowing traffic












1















I have installed Ubuntu 16.04 on a rooted Android box with Linux Deploy to make it a OpenVPN server. I have diligently followed the guide at https://nanashi07.blogspot.com/2017/...id-device.html and the one at https://www.digitalocean.com/communi...n-ubuntu-16-04 and I have used keys and certificates that do work correctly on a Windows server.



The OpenVPN client connects correctly to the server, but at that point it can't go outside. In facts, the only thing I managed to do from the client is ping 10.8.0.6 which is its own IP assigned by the VPN server, can't even ping the server itself. After studying a lot and spending 2 days playing around with configuration, I have come to the conclusion that I need to ask for some help. I can't understand what I am doing wrong.



In particular, some things that I did (as I see they are often reason for a problem similar to mine) are:
modifying the /etc/sysctl.conf file, uncommenting



net.ipv4.ip_forward=1


modified /etc/ufw/before.rules with



# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to eth0
-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# END OPENVPN RULES


modified the the /etc/default/ufw with



DEFAULT_FORWARD_POLICY="ACCEPT"


and I also changed the default input policy to "Accept" for now, this was not required but should not be the cause of my problem.



The openvpn server configuration is



port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh1024.pem
tls-auth ta.key 0
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3


Ifconfig now reads



eth0      Link encap:Ethernet  HWaddr c4:2a:fe:48:63:81
inet addr:192.168.0.174 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::c62a:feff:fe48:6381/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4065 errors:0 dropped:0 overruns:0 frame:0
TX packets:2351 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:997126 (997.1 KB) TX bytes:1110696 (1.1 MB)
Interrupt:56

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 -00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:200 (200.0 B)


Can anyone please help me out?



Many Thanks!










share|improve this question

























  • I have an auth SHA256 after the cipher directive but otherwise my config file is essentially the same as yours. It's been so long since I set it up, I no longer remember the purpose of this directive. Your tun0 output is significantly different from mine, one that jumps out is the P-t-P. Isn't that a different tunneling protocol than OpenVPN? P-t-P does not appear in my tun0 output. Perhaps the problem is in your client settings?

    – Organic Marble
    Feb 3 at 17:49













  • Actually I think it's firewall problem or Linux component missing.I just installed PPTPD server, and that VPN has the same problem, client connects, sends lots of packets but receives very few, and traffic doesn't go out

    – Kurval
    Feb 5 at 16:52











  • I do not believe this will fix your problem but: In your server config file u write:server 10.8.0.0 255.255.255.0 and in your ufw rule u write -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE but it should be -s 10.8.0.0/24 instead. It would be great if you could also post your clients config file.

    – AlexOnLinux
    Feb 10 at 13:52
















1















I have installed Ubuntu 16.04 on a rooted Android box with Linux Deploy to make it a OpenVPN server. I have diligently followed the guide at https://nanashi07.blogspot.com/2017/...id-device.html and the one at https://www.digitalocean.com/communi...n-ubuntu-16-04 and I have used keys and certificates that do work correctly on a Windows server.



The OpenVPN client connects correctly to the server, but at that point it can't go outside. In facts, the only thing I managed to do from the client is ping 10.8.0.6 which is its own IP assigned by the VPN server, can't even ping the server itself. After studying a lot and spending 2 days playing around with configuration, I have come to the conclusion that I need to ask for some help. I can't understand what I am doing wrong.



In particular, some things that I did (as I see they are often reason for a problem similar to mine) are:
modifying the /etc/sysctl.conf file, uncommenting



net.ipv4.ip_forward=1


modified /etc/ufw/before.rules with



# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to eth0
-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# END OPENVPN RULES


modified the the /etc/default/ufw with



DEFAULT_FORWARD_POLICY="ACCEPT"


and I also changed the default input policy to "Accept" for now, this was not required but should not be the cause of my problem.



The openvpn server configuration is



port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh1024.pem
tls-auth ta.key 0
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3


Ifconfig now reads



eth0      Link encap:Ethernet  HWaddr c4:2a:fe:48:63:81
inet addr:192.168.0.174 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::c62a:feff:fe48:6381/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4065 errors:0 dropped:0 overruns:0 frame:0
TX packets:2351 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:997126 (997.1 KB) TX bytes:1110696 (1.1 MB)
Interrupt:56

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 -00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:200 (200.0 B)


Can anyone please help me out?



Many Thanks!










share|improve this question

























  • I have an auth SHA256 after the cipher directive but otherwise my config file is essentially the same as yours. It's been so long since I set it up, I no longer remember the purpose of this directive. Your tun0 output is significantly different from mine, one that jumps out is the P-t-P. Isn't that a different tunneling protocol than OpenVPN? P-t-P does not appear in my tun0 output. Perhaps the problem is in your client settings?

    – Organic Marble
    Feb 3 at 17:49













  • Actually I think it's firewall problem or Linux component missing.I just installed PPTPD server, and that VPN has the same problem, client connects, sends lots of packets but receives very few, and traffic doesn't go out

    – Kurval
    Feb 5 at 16:52











  • I do not believe this will fix your problem but: In your server config file u write:server 10.8.0.0 255.255.255.0 and in your ufw rule u write -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE but it should be -s 10.8.0.0/24 instead. It would be great if you could also post your clients config file.

    – AlexOnLinux
    Feb 10 at 13:52














1












1








1


1






I have installed Ubuntu 16.04 on a rooted Android box with Linux Deploy to make it a OpenVPN server. I have diligently followed the guide at https://nanashi07.blogspot.com/2017/...id-device.html and the one at https://www.digitalocean.com/communi...n-ubuntu-16-04 and I have used keys and certificates that do work correctly on a Windows server.



The OpenVPN client connects correctly to the server, but at that point it can't go outside. In facts, the only thing I managed to do from the client is ping 10.8.0.6 which is its own IP assigned by the VPN server, can't even ping the server itself. After studying a lot and spending 2 days playing around with configuration, I have come to the conclusion that I need to ask for some help. I can't understand what I am doing wrong.



In particular, some things that I did (as I see they are often reason for a problem similar to mine) are:
modifying the /etc/sysctl.conf file, uncommenting



net.ipv4.ip_forward=1


modified /etc/ufw/before.rules with



# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to eth0
-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# END OPENVPN RULES


modified the the /etc/default/ufw with



DEFAULT_FORWARD_POLICY="ACCEPT"


and I also changed the default input policy to "Accept" for now, this was not required but should not be the cause of my problem.



The openvpn server configuration is



port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh1024.pem
tls-auth ta.key 0
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3


Ifconfig now reads



eth0      Link encap:Ethernet  HWaddr c4:2a:fe:48:63:81
inet addr:192.168.0.174 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::c62a:feff:fe48:6381/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4065 errors:0 dropped:0 overruns:0 frame:0
TX packets:2351 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:997126 (997.1 KB) TX bytes:1110696 (1.1 MB)
Interrupt:56

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 -00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:200 (200.0 B)


Can anyone please help me out?



Many Thanks!










share|improve this question
















I have installed Ubuntu 16.04 on a rooted Android box with Linux Deploy to make it a OpenVPN server. I have diligently followed the guide at https://nanashi07.blogspot.com/2017/...id-device.html and the one at https://www.digitalocean.com/communi...n-ubuntu-16-04 and I have used keys and certificates that do work correctly on a Windows server.



The OpenVPN client connects correctly to the server, but at that point it can't go outside. In facts, the only thing I managed to do from the client is ping 10.8.0.6 which is its own IP assigned by the VPN server, can't even ping the server itself. After studying a lot and spending 2 days playing around with configuration, I have come to the conclusion that I need to ask for some help. I can't understand what I am doing wrong.



In particular, some things that I did (as I see they are often reason for a problem similar to mine) are:
modifying the /etc/sysctl.conf file, uncommenting



net.ipv4.ip_forward=1


modified /etc/ufw/before.rules with



# START OPENVPN RULES
# NAT table rules
*nat
:POSTROUTING ACCEPT [0:0]
# Allow traffic from OpenVPN client to eth0
-A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE
COMMIT
# END OPENVPN RULES


modified the the /etc/default/ufw with



DEFAULT_FORWARD_POLICY="ACCEPT"


and I also changed the default input policy to "Accept" for now, this was not required but should not be the cause of my problem.



The openvpn server configuration is



port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key # This file should be kept secret
dh dh1024.pem
tls-auth ta.key 0
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1 bypass-dhcp"
push "dhcp-option DNS 8.8.8.8"
push "dhcp-option DNS 8.8.4.4"
keepalive 10 120
cipher AES-256-CBC
comp-lzo
persist-key
persist-tun
status openvpn-status.log
verb 3


Ifconfig now reads



eth0      Link encap:Ethernet  HWaddr c4:2a:fe:48:63:81
inet addr:192.168.0.174 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::c62a:feff:fe48:6381/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4065 errors:0 dropped:0 overruns:0 frame:0
TX packets:2351 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:997126 (997.1 KB) TX bytes:1110696 (1.1 MB)
Interrupt:56

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 -00
inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:0 (0.0 B) TX bytes:200 (200.0 B)


Can anyone please help me out?



Many Thanks!







networking server vpn firewall openvpn






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Feb 3 at 16:54







Kurval

















asked Feb 3 at 16:21









KurvalKurval

62




62













  • I have an auth SHA256 after the cipher directive but otherwise my config file is essentially the same as yours. It's been so long since I set it up, I no longer remember the purpose of this directive. Your tun0 output is significantly different from mine, one that jumps out is the P-t-P. Isn't that a different tunneling protocol than OpenVPN? P-t-P does not appear in my tun0 output. Perhaps the problem is in your client settings?

    – Organic Marble
    Feb 3 at 17:49













  • Actually I think it's firewall problem or Linux component missing.I just installed PPTPD server, and that VPN has the same problem, client connects, sends lots of packets but receives very few, and traffic doesn't go out

    – Kurval
    Feb 5 at 16:52











  • I do not believe this will fix your problem but: In your server config file u write:server 10.8.0.0 255.255.255.0 and in your ufw rule u write -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE but it should be -s 10.8.0.0/24 instead. It would be great if you could also post your clients config file.

    – AlexOnLinux
    Feb 10 at 13:52



















  • I have an auth SHA256 after the cipher directive but otherwise my config file is essentially the same as yours. It's been so long since I set it up, I no longer remember the purpose of this directive. Your tun0 output is significantly different from mine, one that jumps out is the P-t-P. Isn't that a different tunneling protocol than OpenVPN? P-t-P does not appear in my tun0 output. Perhaps the problem is in your client settings?

    – Organic Marble
    Feb 3 at 17:49













  • Actually I think it's firewall problem or Linux component missing.I just installed PPTPD server, and that VPN has the same problem, client connects, sends lots of packets but receives very few, and traffic doesn't go out

    – Kurval
    Feb 5 at 16:52











  • I do not believe this will fix your problem but: In your server config file u write:server 10.8.0.0 255.255.255.0 and in your ufw rule u write -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE but it should be -s 10.8.0.0/24 instead. It would be great if you could also post your clients config file.

    – AlexOnLinux
    Feb 10 at 13:52

















I have an auth SHA256 after the cipher directive but otherwise my config file is essentially the same as yours. It's been so long since I set it up, I no longer remember the purpose of this directive. Your tun0 output is significantly different from mine, one that jumps out is the P-t-P. Isn't that a different tunneling protocol than OpenVPN? P-t-P does not appear in my tun0 output. Perhaps the problem is in your client settings?

– Organic Marble
Feb 3 at 17:49







I have an auth SHA256 after the cipher directive but otherwise my config file is essentially the same as yours. It's been so long since I set it up, I no longer remember the purpose of this directive. Your tun0 output is significantly different from mine, one that jumps out is the P-t-P. Isn't that a different tunneling protocol than OpenVPN? P-t-P does not appear in my tun0 output. Perhaps the problem is in your client settings?

– Organic Marble
Feb 3 at 17:49















Actually I think it's firewall problem or Linux component missing.I just installed PPTPD server, and that VPN has the same problem, client connects, sends lots of packets but receives very few, and traffic doesn't go out

– Kurval
Feb 5 at 16:52





Actually I think it's firewall problem or Linux component missing.I just installed PPTPD server, and that VPN has the same problem, client connects, sends lots of packets but receives very few, and traffic doesn't go out

– Kurval
Feb 5 at 16:52













I do not believe this will fix your problem but: In your server config file u write:server 10.8.0.0 255.255.255.0 and in your ufw rule u write -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE but it should be -s 10.8.0.0/24 instead. It would be great if you could also post your clients config file.

– AlexOnLinux
Feb 10 at 13:52





I do not believe this will fix your problem but: In your server config file u write:server 10.8.0.0 255.255.255.0 and in your ufw rule u write -A POSTROUTING -s 10.8.0.0/8 -o eth0 -j MASQUERADE but it should be -s 10.8.0.0/24 instead. It would be great if you could also post your clients config file.

– AlexOnLinux
Feb 10 at 13:52










0






active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115287%2fissues-with-openvpn-server-accepting-connections-but-not-allowing-traffic%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Ask Ubuntu!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1115287%2fissues-with-openvpn-server-accepting-connections-but-not-allowing-traffic%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

 ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕