简单快捷十分钟搞定docker 安装openwrt
1、开启网卡混杂模式
sudo ip link set eth0 promisc on
2、创建 docker 网卡
docker network create -d macvlan --subnet=192.168.31.0/24 --gateway=192.168.31.1 -o parent=eth0 macnet
3、docker运行
docker run --restart always --name openwrt -d --network macnet --privileged registry.cn-shanghai.aliyuncs.com/suling/openwrt:x86_64 /sbin/init
4、修改network 配置后台地址
docker exec -it xxxx /bin/bash
# xxxx为容器id
vim /etc/config/netwrok
根据自身网络配置文件内容,博主此次采用的是旁路由模式 配置文件如下
config interface 'lan'
option type 'bridge' #桥接
option ifname 'eth0' #网卡名
option proto 'static' #静态ip模式
option netmask '255.255.255.0'
option ip6assign '60'
option ipaddr '192.168.31.2' #openwrt的ip
option gateway '192.168.31.1' #主路由ip
option dns '192.168.31.1' #主路由作为dns
/etc/init.d/network restart
遇见的坑
- inter nuc的网卡存在不兼容的bug
- 恩山的固件有些存在自身bug 也可能和inter网卡的bug有关