0

I am following this tutorial to set a VPN. Everything was going smoothly until I encountered step #8 on the server side setup:

8. Finally if you wish the clients to communicate with one another, you will have to add the following rules.
# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE && iptables-save

In the above rule, you will have to replace "eth0" with the internet connection that is used by the server. You can use the commands, iwconfig and ifconfig to figure this out.

# iptables --table nat --append POSTROUTING --out-interface ppp0 -j
# iptables -I INPUT -s 172.20.0.0/20 -i ppp0 -j ACCEPT
# iptables --append FORWARD --in-interface eth0 -j ACCEPT

The above rule also requires you to use the correct internet connection like for the first rule.

The text above is easier to read on this page. (ALREADY REFERENCED BEFORE). What I am not sure is what it means "replace eth0 with the internet..." part. I used ifconfig and iwconfigand got the following results:

-----IFCONFIG-----

lo        Link encap:Bucle local  
          Direc. inet:127.0.0.1  Másc:255.0.0.0
          Dirección inet6: ::1/128 Alcance:Anfitrión
          ACTIVO BUCLE FUNCIONANDO  MTU:65536  Métrica:1
          Paquetes RX:22955 errores:0 perdidos:0 overruns:0 frame:0
          Paquetes TX:22955 errores:0 perdidos:0 overruns:0 carrier:0
          colisiones:0 long.colaTX:1 
          Bytes RX:2426706 (2.4 MB)  TX bytes:2426706 (2.4 MB)

wlp2s0    Link encap:Ethernet  direcciónHW d0:53:49:20:28:5c  
          Direc. inet:192.168.1.34  Difus.:192.168.1.255  Másc:255.255.255.0
          Dirección inet6: fe80::ce80:2746:f707:ad1c/64 Alcance:Enlace
          ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST  MTU:1500  Métrica:1
          Paquetes RX:3756393 errores:0 perdidos:0 overruns:0 frame:0
          Paquetes TX:2189595 errores:0 perdidos:0 overruns:0 carrier:0
          colisiones:0 long.colaTX:1000 
          Bytes RX:4710198766 (4.7 GB)  TX bytes:343761733 (343.7 MB)

-----IWCONFIG----

wlp2s0    IEEE 802.11  ESSID:"MOVISTAR_FF04"  
          Mode:Managed  Frequency:2.447 GHz  Access Point: F8:8E:85:FD:FF:59   
          Bit Rate=65 Mb/s   Tx-Power=16 dBm   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          Link Quality=65/70  Signal level=-45 dBm  
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:34  Invalid misc:2298   Missed beacon:0

lo        no wireless extensions.

I want to be sure of what I am doing and not to make any mistakes, specially since I don't know if I am going to destroy my pc and the rooter in the process, or something worse C:. So,

  1. Is this tutorialthe way to go? Yes or no would be enough.
  2. Can someone tell me with what should I replace "eth0" in the first rule??

I have an Ubuntu LTS 16.04 64bits distro. Thanks in advance!

  • The tutorial is about setting up a VPN server. What you likely want is a VPN client. This is done with a few clicks in the Network Manager configuration, and doesnt require changing firewall rules... – xenoid Jun 3 '17 at 22:48
  • I want also that other computers in my network can connect to this VPN, that is why I though a server...I guess I was wrong. Anyhow, could you be so kind and point me on the rigth direction? – kamatheuska Jun 3 '17 at 23:19
  • You want your computer to act as a "gateway" for other computers, the only difference with a classic gateway is that you would route connection to the established VPN instead of a second ethernet connection. See here – xenoid Jun 4 '17 at 8:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.