docker stop openwrt
docker rm openwrt
docker network rm opvlan-net
docker network create -d ipvlan \
--subnet=192.168.1.0/24 \
--gateway=192.168.1.1 \
-o parent=wlp1s0 \
-o ipvlan_mode=l2 \
opvlan-net
docker run \
--name openwrt \
--network opvlan-net \
--privileged \
--sysctl net.ipv6.conf.all.disable_ipv6=0 \
-d xinebf/openwrt:24.10.0-x86-64 /sbin/init
docker exec -it openwrt sh
#######
cat <<EOF > /etc/config/network
config interface 'loopback'
option device 'lo'
option proto 'static'
option ipaddr '127.0.0.1'
option netmask '255.0.0.0'
config globals 'globals'
option ula_prefix 'fd55:ab29:3c94::/48'
config interface 'lan'
option device 'eth0'
option proto 'static'
option ipaddr '192.168.1.6'
option netmask '255.255.255.0'
option gateway '192.168.1.1'
option ipbassign '60'
EOF
/etc/init.d/network restart
ifconfig
# 修改 netwrok 的 ip 为 eth0 获得的 ip 并重启网络
Content type
Image
Digest
sha256:dc573ce51…
Size
4.5 MB
Last updated
over 1 year ago
docker pull xinebf/openwrt:latest-x86-64