How Orange Pi Gave Me Back YouTube
Hardware specification
CPU | Allwinner H616 64-bit high-performance Quad-core Cortex-A53 processor |
GPU | • Mali G31 MP2• Supports OpenGL ES 1.0/2.0/3.2、OpenCL 2.0 |
Video decoding | • H.265 Main10@L5.1 decoder up to 4K@60fps or 6K@30fps• VP9 Profile 2 decoder up to 4K@60fps• AVS2 JiZhun 10bit decoder up to 4K@60fps• H.264 BP/MP/HP@L4 .2 decoder up to 4K@30fps |
Video encoding | • H.264 BP/MP/HP encoder up to 4K@25fps or 1080p@60fps • JPEG snapshot performance of 1080p@60fps |
Memory(SDRAM) | 512MB/1GB DDR3 (Shared with GPU) |
Onboard Storage | • TF card slot • 2MB SPI Flash |
Onboard Network | Support 1000M/100M/10M Ethernet |
Onboard WiFi+BT | • 859 Chip • Support IEEE 802.11 a/b/g/n/ac • Support BT5.0 |
Video Outputs | • Micro HDMI 2.0a up to 4K@60fps • TV CVBS output, Support PAL/NTSC(Via 13pin interface board) |
Audio output | • Micro HDMI• 3.5mm audio port (Via 13pin interface board) |
Power Source | Type-C interface 5V3A input |
USB 2.0 Ports | 3*USB 2.0 HOST(Two of them are via 13pin interface board) |
Low-level peripherals | • 26pin header with I2C, SPI, UART and multiple GPIO ports• 13pin header with 2*USB Host, IR pin, Tv-out、AUDIO (no MIC) and 3 GPIO ports |
Debug serial port | UART-TX、UART-RX and GND |
LED | Power LED & Status LED |
IR receiver | Support IR remote control (via 13pin interface board) |
Supported OS | Android10、Ubuntu、Debian |
Appearance specification introduction
Dimension | 53mm×60mm |
Weight | 30g |
Since my devices that use the YouTube video service are connected via wireless connection and based on the board specification, the following concept emerges:
We will use the wired network interface (Ethernet) for (external) connection to the Internet, in my case to a network router, and on the wireless module of the single-board computer we will implement a Wi-Fi Hotspot for connecting our devices, and all the “magic” will be performed using the software installed on the single-board computer.
Installing software
The operating system used is Debian 12 without a graphical shell; you can download the system image from the official Orange Pi website.
Wi-Fi hotspot in this solution is implemented using the hostapd package, before further actions, it is recommended to update the packages using the command
sudo apt-get update
sudo apt upgrade
Installing and configuring hostapd
sudo apt-get install hostapd
Edit the configuration file /etc/default/hostapd.conf.
sudo nano /etc/default/hostapd.conf
In the configuration file, uncomment the following line
DAEMON_CONF="/etc/hostapd/hostapd.conf"
And just in case, let's stop the hostapd service
service hostapd stop
Let's edit the configuration file of our Wi-Fi hotspot:
sudo nano /etc/hostapd/hostapd.conf
Let's bring the file to the following content
interface=wlan0
driver=nl80211
country_code=RU
ssid=INTERNETFORYOUTUBE #Wi-Fi AP SSID
hw_mode=a
channel=36
ieee80211n=1
ieee80211ac=1
vht_capab=[VHT80][SHORT-GI-80]
wpa=2
wpa_passphrase=YOUTUBE12345 #PASSWORD
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
This configuration implements a 5 GHz Wi-Fi access point, 802.11n, 802.11ac standard, frequency channel 36, wlan0 – wireless network interface, defined using the command:
ip a
Next we need to configure the wireless interface by editing the following file using the command:
sudo nano /etc/network/interfaces
The contents of the file must be brought to the following
source /etc/network/interfaces.d/*
# Network is managed by Network manager
auto lo
iface lo inet loopback
auto wlan0
iface wlan0 inet static
address 192.168.50.1
netmask 255.255.255.0
gateway 192.168.50.1
In this file we have specified a static address configuration for the wireless interface.
Now, for our hotspot to work correctly, we need to set up automatic distribution of addresses for clients. To do this, we implement the DHCP service using dnsmasq.
Installing dnsmasq:
sudo apt-get install dnsmasq
And, just in case, let's stop the service.
service dnsmasq stop
Configuring dnsmasq
sudo nano /etc/dnsmasq.conf
And we bring the configuration file to the following content
interface=wlan0 # Use interface wlan0
listen-address=192.168.50.1 # Explicitly specify the address to>
bind-interfaces # Bind to the interface to make sur>
server=8.8.8.8 # Forward DNS requests to Google DNS
domain-needed # Don't forward short names
bogus-priv # Never forward addresses
dhcp-range=192.168.50.50,192.168.50.150,12h # IP range DHCP
In our magic we will use a local Socks 5 proxy server, and to be able to use it, we will use the Redsocks package
Installing and configuring redsocks
sudo apt-get install redsocks
Editing the configuration file
sudo nano /etc/redsocks.conf
Let's bring the configuration file to the following content:
base {
log_debug = off;
log_info = on;
log = "file:/var/log/redsocks.log";
daemon = on;
redirector = iptables;
}
redsocks {
local_ip = 0.0.0.0;
local_port = 12345;
ip = 127.0.0.1;
port = 1080;
type = socks5;
}
Now we need to wrap all traffic from hotspot clients into our future socks 5 proxy. We will implement this task using iptables:
sudo iptables -t nat -N REDSOCKS
sudo iptables -t nat -A REDSOCKS -d 192.168.50.0/24 -j RETURN # Исключаем локальную сеть
sudo iptables -t nat -A REDSOCKS -p tcp -j REDIRECT --to-ports 12345
sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp -j REDSOCKS
Next, we would like to save these rules and implement their loading at system startup:
Saving current iptables rules to the iptables.rules file. Create a file and restrict access to it
sudo touch /etc/iptables.rules
sudo chmod 640 /etc/iptables.rules
Save current iptables rules to a file
sudo iptables-save | sudo tee /etc/iptables.rules
Autoloading of saved rules. In /etc/network/if-pre-up.d/ create a file iptables with the following contents:
#!/bin/sh
iptables-restore < /etc/iptables.rules
exit 0
Making the created script executable
sudo chmod +x /etc/network/if-pre-up.d/iptables
Now for a little magic to make it all work, we'll use “ciadpi”
Create the ciadpi service as a non-root user, for example orangepi. Log in as orangepi and clone the repository:
git clone https://github.com/hufrea/byedpi
Go to the folder with the repository and build
сd byedpi
make
Next we need to create a service to autoload our magic:
nano /etc/systemd/system/byedpi_orange_pi.service
And we save the following content
[Unit]
Description=dpi port 1080
After=network.target
[Service]
User=orangepi
Group=orangepi
ExecStart=/home/orangepi/byedpi/ciadpi --disorder 1 --auto=torst --tlsrec 1+s
[Install]
WantedBy=multi-user.target
Adding a script to startup
systemctl enable byedpi_orange_pi
Reboot the system and check the operation
sudo shutdown -r now
Let's sum it up
In this article I tried to clearly describe my technical experience in restoring access to YouTube using the Orange Pi zero 2 debug board.
If you liked the article, then support it with the up arrow. If you have something to add or want to share a similar experience, then welcome to the comments! Good health to all, and thank you for your attention!
Please note that this article does not popularize or persuade the user to bypass blocking. It only describes a particular technical case, which is difficult to implement for an ordinary person.