Raspbeery Pi3 with 2 wifi donggle/VPN router

connecting to a WPA WiFi network, your /etc/network/interfaces file will contain something like this:

allow-hotplug wlan0 # detect WiFi adapter
iface wlan0 inet dhcp # connect WiFi with DHCP
wpa-ssid “myhostnetwork” # WPA access point name
wpa-psk “myhostpassword” # WPA access point password

Manually restart WiFi to connect the Raspberry Pi to the Internet.
$ sudo ifdown wlan0
$ sudo ifup wlan0

You can validate that you have a WiFi connection by pinging a website or running the command:

$ ifconfig wlan0

Installing hostapd
$ wget https://github.com/jenssegers/RTL8188-hostapd/archive/v1.1.tar.gz
$ tar -zxvf v1.1.tar.gz
$ cd RTL8188-hostapd-1.1/hostapd
$ make
$ sudo make install


$ sudo service hostapd start
$ sudo update-rc.d hostapd enable

Install DHCP server
$ sudo apt-get install dnsmasq

dhcp-option=3, # our router
dhcp-option=6, # our DNS Server
dhcp-authoritative # force clients to grab a new IP


iface wlan1 inet static

$ sudo ifdown wlan1
$ sudo ifup wlan1
$ sudo service dnsmasq start
$ sudo update-rc.d dnsmasq enable

TOR, or The Onion Router, is an encryption technology that encrypts and distributes your internet data across a network of computers on the way back and forth to a website.
VPNs can be more secure than TOR if you trust your VPN server.

To install TOR,
$ sudo apt-get install tor
$ sudo service tor start
$ sudo update-rc.d tor enable

Installing VPN
$ sudo apt-get install openvpn

Edit /etc/openvpn/client.conf
$ sudo service ntp start
$ sudo update-rc.d ntp enable

$ sudo service openvpn start
$ sudo update-rc.d openvpn enable

$ echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
sudo iptables –t nat –A POSTROUTING –o tun0 -j MASQUERADE
$ sudo iptables –A FORWARD –i wlan1 –o tun0 -j ACCEPT
$ sudo iptables –A FORWARD –i tun0 -o wlan1 –m state –state RELATED,ESTABLISHED –j ACCEPT

persistent the settings
$ sudo sh –c “iptables-save > /etc/iptables.restore”
$ echo “up iptables-restore < /etc/iptables.restore” | sudo tee --append /etc/network/interfaces https://makezine.com/projects/browse-anonymously-with-a-diy-raspberry-pi-vpntor-router/


电子邮件地址不会被公开。 必填项已用*标注