用群辉docker安装openwrt充当旁路由

安装docker镜像

  1. 设置宿主机网卡混杂模式

登录host宿主机执行:

sudo ip link set eth0 promisc on 
  1. 创建docker 网络 (macvlan)
docker network create -d macvlan --subnet=192.168.31.0/24 --gateway=192.168.31.1 -o parent=eth0 macnet
  1. 下载docker openwrt/rootfs 镜像并且启动
  2. 容器并将其加入到创建的macvlan网络中

设置路由默认网关

  1. 登录到路由器(openwrt) 增加默认网关

通过ssh 或docker exec 连接到 openwrt容器,执行创建默认网关命令:

route add default gw 192.168.31.1

其中 192.168.31.1网关, 即是host所在环境的路由网关

至此设置完成后,路由器可以正常上网,接下来就是安装一些软件包了

安装openwrt软件包

  1. 配置opkg软件源镜像(使用中科大镜像)
sed -i 's/downloads.openwrt.org/mirrors.ustc.edu.cn\/openwrt/g' /etc/opkg/distfeeds.conf
  1. 更新软件包
opkg update

3.安装luci web管理端

opkg install luci

研究科学
https://github.com/v2rayA/v2raya-openwrt

发表新评论