Before We Start
In order to follow this guide, I assume you already have:
- A machine which is running Openwrt/LEDE in docker
- Already install the portainer to manage the docker image
I will use Phicomm N1 as an example.
Backup Your Setting
Login to your Openwrt dashboard and select backup/flash firmware under the system section. Make a backup of your current setting.
Upload Your Local Image
Use SCP or FTP tool to upload your local image to your N1 /root folder
Import and Config Openwrt
Use following command to import the image to the docker
docker import [your file name] openwrt:[your own tag] ip link set eth0 promisc on ## X equals to your main router gateway (if your main router is 192.168.123.1, then X=123) docker network create -d macvlan --subnet=192.168.X.0/24 --gateway=192.168.x.1 -o parent=eth0 macnet docker run --restart always -d --network macnet --privileged openwrt:[your own tag] /sbin/init
Login to your portainer control panel and choose Local—containers
Delete your old OpenWrt image(you will lose internet connection temporarily), then select fourth option on the new OpenWrt image and choose connect
vi /etc/config/network ## Keyboard input i to enable edit ## Change the third number to your main router gateway ## Save and Exit ## Keyboard input ESC to exit edit :wq
Restart your OpenWrt image and it’s done
中文教程由此开始
开始之前
为了跟随此教程,我默认你已经有了
备份设置
登录你现在的OpenWrt固件后台,并在系统选项下选择备份/更新,备份现有设置
上传本地镜像
利用SCP或者FTP工具上传本地的镜像文件到N1的/root目录下
导入并设置OpenWrt
用以下命令将本地镜像导入Docker
docker import [your file name] openwrt:[your own tag] ip link set eth0 promisc on ## X 等于你主路由的网段 (例如你的主路由地址是 192.168.123.1, 那么X=123) docker network create -d macvlan --subnet=192.168.X.0/24 --gateway=192.168.x.1 -o parent=eth0 macnet docker run --restart always -d --network macnet --privileged openwrt:[your own tag] /sbin/init
登录你的portainer后台并选择容器
删除你之前的OpenWrt镜像(你会暂时失去网络连接),并在新导入的镜像上选择第四项,并连接
vi /etc/config/network ## 键盘输入 i 开启编辑 ## 将以下栏目的第三个数字改为你的主路由网段地址 ## 保存并退出 ## 键盘输入ESC退出编辑模式 :wq
重启OpenWrt镜像完成配置