下载镜像
#docker pull sulinggg/openwrt:armv7
#docker pull sulinggg/openwrt-mini:armv7
#docker pull virking/openwrt:20.04
#docker pull virking/openwrt:18.06
#docker pull kanshudj/n1-openwrtgateway
#docker pull dickhub/openwrt:armv7
sulinggg/openwrt:arm_cortex-a5_vfpv4
开启网卡混杂
ip link set eth0 promisc on
docker network create -d macvlan --subnet=192.168.0.0/24 --gateway=192.168.0.1 -o parent=eth0 macnet
启动openwrt容器
docker run -itd --name=sunlinggg --restart=always --network=macnet --privileged=true sulinggg/openwrt:arm_cortex-a5_vfpv4 /sbin/init
编辑网卡
docker exec -it sunlinggg bash
vim /etc/config/network
config interface 'loopback'
option ifname 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fdba:a6ee:63ef::/48'
config interface 'lan'
option ifname 'eth0'
option proto 'static'
option ipaddr '192.168.0.6'
option netmask '255.255.255.0'
option ip6assign '60'
option gateway '192.168.0.1'
option dns '192.168.0.1'
config interface 'vpn0'
option ifname 'tun0'
option proto 'none'
重启
/etc/init.d/network restart
默认IP: 192.168.1.1 默认密码: password
接口 - LAN 取消桥接接口
选项 (初次取消会连不上,过段时间再取消却可以)
注:如果用这个固件做旁路由的话不要忘了加自定义防火墙规则(网络->防火墙->自定义规则):
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE
也可以尝试(有桥接存在的情况下)
iptables -t nat -I POSTROUTING -o br-lan -j MASQUERADE
在Docker 中运行 OpenWrt 旁路网关
[2020-10-18]★46+o版, S905x3、N1、贝壳云、我家云等op固件-恩山无线论坛 (right.com.cn)
sulinggg/openwrt - Docker Image | Docker Hub
sulinggg/openwrt-mini - Docker Image | Docker Hub
SuLingGG/OpenWrt-Docker
在Docker 中运行 OpenWrt 旁路网关
玩客云可以安装armbian与openwrt
玩客云docker安装openwrt
unix下安装docker并挂载openwrt全流程全踩坑