使用N1搭建局域网软路由
dockerhub地址
1 | https://hub.docker.com/r/kanshudj/n1-openwrtgateway/tags |
拉取镜像
1 | docker pull kanshudj/n1-openwrtgateway:r9.10.1 |
开启网卡混合模式
1 | ip link set eth0 promisc on |
创建docker的虚拟网络(可用docker network ls查看已创建了哪些)
1 | docker network create -d macvlan --subnet=192.168.2.0/24 --gateway=192.168.2.1 -o parent=eth0 macnet |
开启openwrt容器:
1 | docker run --restart always -d --network macnet --privileged unifreq/openwrt-aarch64:r9.10.24 /sbin/init |
进入容器
1 | docker exec -it openwrt /bash/bin |
编辑网卡
1 | vi /etc/config/network |
重启网络设置
1 | /etc/init.d/network restart |