📜 ⬆️ ⬇️

iPhone — like a full gprs / 3g modem using VPN over SSH.

Apparently for the reason that Apple is interested in unlimited Internet only on the iPhone itself (and not on devices connected to the iPhone), they built the OS kernel without incorporating DIVERT technology in it, which allows using NAT similar to the one usually installed in routers Internet "gray" networks (those that are 192.168.0.0/24 for example).

Fortunately, using third-party software on the iPhone, you can run socks –server, but a lot of programs cannot work with it.

However, we have the ability to use SSH and tunneling of traffic on the iPhone, which partially allows us to be incomplete and rather uncomfortable, but get the necessary services from the Internet.
')
But it turns out that such tunneling is enough that, thanks to the OpenVPN program, to establish communication with a remote server that can both route and NAT-it.

The only caveat: you need a remote server, which will be your router. This requires a regular server with a real white IP address (dynamic can also be used, for example, using dynDNS). Such server can be: home computer, server at work, VPS, etc.

First you need to do a little preparatory work:
  1. SSH must be installed on iPhone
  2. On the server and on the computer install OpenVPN [http://openvpn.net/]
  3. Configure configs on the computer and on the server for OpenVPN. A simple configuration case is something like this:
    1. Generate a secret key:
      openvpn --genkey --secret static.key
      and copy it to the configs folder on the server and computer
    2. Configuring the server config:
      dev tap
      proto tcp-server
      ifconfig 192.168.20.13 255.255.255.0
      push "dhcp-option DNS 192.168.20.13"
      secret static.key
      comp-lzo
      keepalive 10 120
      verb 3
      log openvpn.log
    3. Configuring the config on the computer:
      dev tap
      proto tcp-client
      remote localhost
      ifconfig 192.168.20.11 255.255.255.0
      route-gateway 192.168.20.13
      redirect-gateway
      push "dhcp-option DNS 192.168.20.13"
      secret static.key
      comp-lzo
      verb 3
      route-method exe # windows
      route-delay 2 # linux mac
  4. The server must be running a DNS server, NAT
  5. We must not forget to wrap traffic from the network 192.168.20.0/24 in NAT
  6. Run and leave running the server part of OpenVPN

Next, the actual installation of the connection:
  1. Make sure the iPhone is on the Internet, and then you never know 
  2. Create a tunnel from your computer to a remote server via iPhone: L1194 server.ru:1194 | root @ alpine
  3. Run on a computer OpenVPN: openvpn client.ovpn

And if everything worked out, then you already have a full Internet on your computer. (although I don’t think it will work out on the first attempt;))

In principle, for convenience, paragraphs 2 and 3 can be placed in 1 label.

Source: https://habr.com/ru/post/41472/


All Articles