Skip to content
Advertisement

ToyVpn: unable to settup vpn server and connecting to it also no rule is appearing the nat table

I am trying to setup VPN server on my PC. I gave commands which are given in ToyVpnServer file but after giving the last command terminal looks stuck, and from the Android phone I used ToyVpn to connect to it but it is not connecting…

The commands are given below:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 10.0.0.0/8 -o eth0 -j MASQUERADE #I tried this command with both "-A" and "-I" but nothing appears in the nat table :(
ip tuntap add dev tun0 mode tun
ifconfig tun0 10.0.0.1 dstaddr 10.0.0.2 up
./a.out tun0 8000 test -m 1400 -a 10.0.0.2 32 -d 8.8.8.8 -r 0.0.0.0 0

In ToyVpnClient I gave IP address of my PC, which is like 192.168.2.xxx/24. And the IP address of phone is also like 192.168.2.xxx/24.

Also the rule which I just entered in the nat table is not appearing there. I tried with both “-I” and “-A”.

I’m not much familiar with the linux, iptable and server. What is going wrong here?

(I also tried to set the server via this tutorial, http://cviorel.easyblog.ro/2009/02/09/how-to-set-up-a-vpn-server-on-ubuntu/, but I got following error( https://askubuntu.com/questions/222495/firewall-stopped-and-disabled-on-system-startup-error-problem-running-ufw-init):

Firewall stopped and disabled on system startup
ERROR: problem running ufw-init 

Advertisement

Answer

This problem is solved.

I was trying to set VPN server with the help of this answer, https://askubuntu.com/questions/56559/how-do-i-set-up-a-pptp-vpn-on-my-own-ubuntu-server/58558#58558.

To follow the procedure , I disabled the UFW firewall.

I don’t know exactly what changed but finally VPN server was setup and through the VPN client of Ubuntu I was able to connect to it. So, I reopened the file of TOyVpnServer file and gave the commands and this time they worked. I was able to see the new rule in the nat table (which was not appearing previously…) and when I connected to server from phone then it connected successfully.

I don’t have much understanding of firewalls etc…So, according to my understanding, disabling of ufw solved the issue.

I would highly appreciate, if someone can give better description of exactly what changed after disabling the ufw or if ufw can not be the actual reason then any correction is welcomed.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement