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!
- Download necessary software packages from cydia:
OpenSSL,OpenSSH,SBSettings,OpenVpn Toggle for SBSettings,Python
- 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.
- Install Python's pexpect module. Go to renewal
tar zxf pexpect-2.3.tar.gz cd pexpect-2.3 python setup.py install
- 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)
- 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 &
- 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
- 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.
- Enter the terminal environment. Ssh or mobileterminal can both be used.
- Get root permission
- # Scutil enters the scutil environment. The command prompt is>
- > 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
- > 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.
- > D. init
- > Get state:/Network/service/EBF2E739-C251-4B13-82AC-43187C1228A6/DNS
- > D. Add serveraddresses * 208.67.222.222 208.67.220.220
- > Set state:/Network/service/EBF2E739-C251-4B13-82AC-43187C1228A6/DNS