Guangdong Mobile HM201 TV box (Nanchuan license plate) brushes the route beside armian + docker + openwrt

Keywords: Linux Docker ssh

Guangdong Mobile HM201 TV box (Nanchuan license plate) brushes the route beside armian + docker + openwrt

Box information: S905L, 1G+4G, 100m network port, USB2.0x2, 2.4G WiFi (not driven under armbian), no Bluetooth

Input under the built-in Android system terminal:

cat /proc/device-tree/amlogic-dt-id

Results obtained:

gxl_211_1g

1, U SB flash disk burning

Use mirroring:

Armbian_5.77_Aml-s905_Ubuntu_bionic_default_5.0.2_20190401.img

Modify the DTB in the uEnv.ini file under the boot partition of the burned U SB flash disk_ Name value is

/dtb/meson-gxl-s905x-nexbox-a95x.dtb

2, U SB flash disk startup, armian

The USB flash disk is inserted into the USB port near the network port

HDMI connected to display + external keyboard or TTL serial port. When Login appears on the display or terminal window, enter the user name root Login and the initial password 1234. Prompt to change the password, enter the initial password 1234 again, and then enter the new password twice to complete the password change. When prompted to create a new user, press CTRL+C to cancel and log in again with a new password

3, Armbian configuration

Terminal input

armbian-config

System > SSH configure SSH

Personal > timezone change the time zone to Asia > Shanghai

Fix DNS

ln -fs /run/resolvconf/resolv.conf /etc/resolv.conf

4, Install docker

Update container.io (faster going abroad)

Can arrive https://download.docker.com/linux/debian/dists/buster/pool/stable/arm64 View the historical version and the latest version (1.4.3-1 below is the version number)

curl -O https://download.docker.com/linux/debian/dists/buster/pool/stable/arm64/containerd.io_1.4.3-1_arm64.deb
apt install ./containerd.io_1.4.3-1_arm64.deb
curl -fsSL https://get.docker.com -o get-docker.sh | sh get-docker.sh --mirror Aliyun

docker image source

Official image of Docker China:
https://registry.docker-cn.com
Netease:
http://hub-mirror.c.163.com
ustc:
https://docker.mirrors.ustc.edu.cn
University of science and technology of China:
https://docker.mirrors.ustc.edu.cn

vim /etc/docker/daemon.json

Write the following

{
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}

Save and restart Docker service

systemctl daemon-reload
systemctl restart docker.service

Installing the portal

docker run -d -p 9000:9000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce

5, Docker installs OpenWRT for side routing

Pull image

docker pull unifreq/openwrt-aarch64

Enable network card hybrid mode

ip link set eth0 promisc on

Create virtual network (subnet and gateway are modified according to their own network)

docker network create -d macvlan --subnet=192.168.123.0/24 --gateway=192.168.123.1 -o parent=eth0 macnet

Create openwrt container

docker run --name openwrt --restart always -d --network macnet --privileged unifreq/openwrt-aarch64

Enter openwrt container

docker exec -it openwrt bash

Modify the IP (replace 192.168.1.1 after option ipaddr with the IP address you want to log in to OpenWRT, which is the same network segment as the main route)

vi /etc/config/network

Restart the network

/etc/init.d/network restart

Enter the newly modified IP in the browser and log in to OpenWRT

The LAN interface turns off DHCP, the gateway fills in the primary routing IP, and DNS can be the primary routing IP or public DNS such as 114.

Add rule to firewall:

iptables -t nat -I POSTROUTING -j MASQUERADE

And restart the firewall

6, Other settings

Modify the Armbian /etc/network/interfaces file

auto eth0
 iface eth0 inet manual
 up ip link set eth0 promisc on
auto macvlan
 iface macvlan inet static
 address 192.168.123.243 #Specify the IP for the box and modify it according to the actual situation
 netmask 255.255.255.0 
 gateway 192.168.123.1 #Gateway, modified according to the actual situation (primary route or secondary route IP)
 dns-nameservers 192.168.123.1 114.114.114.114 #DNS, a primary routing IP (or side routing IP), a public DNS
 hwaddress ether XX:XX:XX:XX:XX:XX #Specify the MAC address to prevent the MAC address from changing back and forth
 pre-up ip link add macvlan link eth0 type macvlan mode bridge
 post-down ip link del macvlan link eth0 type macvlan mode bridge

Permanently enable network card hybrid mode

ifconfig eth0 promisc

Restart armian

Acknowledgment & Reference:

N1 detailed tutorial on brushing the armian system and installing openwrt side routing in docker_ engineerlzk's column - CSDN blog_ Docker installation openwrt

Posted by MP145 on Mon, 04 Oct 2021 11:23:06 -0700