|
硬件设备:
为联想小新的旧笔记本,系统为ubuntu22.04,安装了docker
操作步骤:
查看网络,找到网卡标记,根据ip地址判断
ifconfig
#得出无线网卡的网卡标记为:wlp2s0
开启网卡混杂模式,且虚拟机和docker里都要开启网卡混杂模式,这里网卡标记根据自己的填写
ip link set wlp2s0 promisc on
#目前已开启网卡混杂模式
在专门建立一个子网,且该网络与家里的局域网在一个网段,网段和网关填自己的
docker network create -d macvlan --subnet=192.168.0.0/24 --gateway=192.168.0.1 -o parent=wlp2s0 opnet
#目前已创立好macvlan网卡
构建docker的命令
sudo docker run --restart always --name opt3 -d --network opnet --ip 192.168.0.3 --privileged sulinggg/openwrt:x86_64 /sbin/init
#已创建好镜像与容器,且在portainer中看到容器已运行,创建的macvlan网卡也在
如果上面那个拉不同就用下面这个
sudo docker run --restart always --name opt3 -d --network opnet --ip 192.168.0.3 --privileged registry.cn-shanghai.aliyuncs.com/suling/openwrt:x86_64 /sbin/init
查看那个docker在运行
sudo docker network ps
进入容器(openwrt)内部,并打开控制台
sudo docker exec -it opt3 /bin/sh
配置网络,i进入编辑,esc退出编辑,:wq保存并退出
vi /etc/config/network
重置网络
/etc/init.d/network restart
目前状况:
在更改并重置网络后,openwrt容器正常运行,但网页打不开,打开日志,显示:
WARNING: Variable 'led' does not exist or is not an array/object
Press the [f] key and hit [enter] to enter failsafe mode
Press the [1], [2], [3] or [4] key and hit [enter] to select the debug level
WARNING: Variable 'led' does not exist or is not an array/object
请各位大佬给小弟支支招,麻烦了
|
|