Openvpn on iPhone

Source: Internet
Author: User

Openvpn on iPhone

To use openvpn on the iPhone, you need to jailbreak first. Here, you don't have to look down. // I personally feel that iPhone is not jailbroken, It is a petty asset, and Unix after Jailbreak!

  1. Download necessary software packages from cydia:OpenSSL,OpenSSH,SBSettings,OpenVpn Toggle for SBSettings,Python
  2. Go to lolihosting to download the openvpn configuration file. I use the default public network configuration provided by the seller. Upload it to the iPhone, and I put it to/var/mobile/library/openvpn/CONF. ovpn.

    Lolihosting uses the user/pass authentication method, while the iPhone openvpn does not support reading username/passwd from a file. Therefore, you must open the terminal each time, it is quite troublesome to enter user/pass from standard input. The old brother used the Python script to replace his work.

  3. Install Python's pexpect module. Go to renewal
    tar zxf pexpect-2.3.tar.gz cd pexpect-2.3 python setup.py install
  4. Create a file/var/mobile/library/openvpn/startopenvpn and set the File Permission to 755.
    #! /Usr/bin/Python import pexpect import sys child = pexpect. spawn ('/usr/bin/openvpn-iPhone -- config/var/mobile/library/openvpn/CONF. ovpn ') child. logfile = sys. stdout child. verify CT ('enter auth Username: ') child. sendline ('your username') child. verify CT ('enter auth password: ') child. sendline ('your password') child. secondary CT (pexpect. EOF, timeout = none)
  5. Modify/var/mobile/library/sbsettings/commands/COM. offinf. openvpnup
    #!/bin/sh [[ -f /var/mobile/Library/SBSettings/Toggles/OpenVpn/OFF ]] && /bin/rm /var/mobile/Library/SBSettings/Toggles/OpenVpn/OFF cd /var/mobile/Library/OpenVpn/ /var/mobile/Library/OpenVpn/startopenvpn >/var/mobile/Library/OpenVpn/ovpn.log &
  6. Modify/var/mobile/library/sbsettings/commands/COM. offinf. openvpndown as follows:
    #!/bin/sh /bin/touch /var/mobile/Library/SBSettings/Toggles/OpenVpn/OFF /usr/bin/killall openvpn-iphone
  7. Enable openvpn Management in sbsetting to start and manage the VPN through sbsetting!

DNS Configuration

After connecting to openvpn, I found a serious problem (I don't know if other people are doing the same). Although I have gained freedom, DNS pollution still exists and various URLs cannot be correctly resolved. I thought of changing DNS, but IOS only provides DNS configuration for WiFi access points. The 3g/edge DNS is not allowed to be changed.

Based on the idea that IOS is also UNIX, I naively thought it would be in/etc/resolv. conf. It turns out that I was wrong. In fact, it is not difficult to modify it. One of Apple's System Configuration tools is scutil // because I don't know much about the Mac OS x Series, I don't know its mechanism, but it is probably quite convenient to use.

  1. Enter the terminal environment. Ssh or mobileterminal can both be used.
  2. Get root permission
  3. # Scutil enters the scutil environment. The command prompt is>
  4. > List, which are similar
    State:/Network/service/EBF2E739-C251-4B13-82AC-43187C1228A6/DNS
    Corresponding to the current network access point, at least 3g/edge, one WiFi, and one Bluetooth
  5. > Show state:/Network/service/EBF2E739-C251-4B13-82AC-43187C1228A6/DNS
    For the above access points, look at the DNS configuration,By yourself(I admit that I don't know about iOS, but I don't know the access point naming rules.) Find the one corresponding to 3G/edge.
  6. > D. init
  7. > Get state:/Network/service/EBF2E739-C251-4B13-82AC-43187C1228A6/DNS
  8. > D. Add serveraddresses * 208.67.222.222 208.67.220.220
  9. > Set state:/Network/service/EBF2E739-C251-4B13-82AC-43187C1228A6/DNS

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.