Docker版OpenWrt旁路由安装设置教程 主机域名 网管技术



关于固件

型号: Generic x86/64

平台: x86/64

版本: 分支: 22.03.5

内核: 5.15.109

生成日期: 2023-04-30 22:20:01

说明: 后台: 10.0.0.1 或 op/  密码: root


cd  /opt/

wget  http://up.htmltoo.com/soft/src/webmaster/openwrt-04.18.2023-x86-64-generic-rootfs.tar.gz

mv  openwrt-04.18.2023-x86-64-generic-rootfs.tar.gz  openwrt.tar.gz


---debian 11 x86_64, root管理员, lan为eth0, ip段 10.0.0.x, 用于拨号的主路由IP:10.0.0.1 ,不要照抄命令,根据自己的实际情况做相应的调整


---打开网卡混杂模式

ip link set eth0 promisc on


---创建网络

https://abc.htmltoo.com/thread-46536.htm


---加载镜像,创建并启动容器

docker import openwrt.tar.gz  openwrt

docker run -d --name openwrt  --restart=always   --privileged=true  --network mgr  --ip 172.18.0.100  -v /etc/localtime:/etc/localtime:ro  -v /data/site/docker/env/tools/openwrt:/opt:ro  -v /data/file:/data/file  openwrt /sbin/init 


---进入容器

docker exec -it openwrt sh


vim  /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 'fd58:7613:bc4f::/48'
       option packet_steering '1'
config device
       option name 'br-lan'
       option type 'bridge'
       list ports 'eth0'
config interface 'lan'
       option device 'br-lan'
       option proto 'static'
       option ipaddr '172.18.0.100'
       option netmask '255.255.255.0'
       option ip6assign '60'
       option gateway '172.18.0.1'
       option broadcast '255.255.255.0'
       option dns '172.18.0.1'

/etc/init.d/network restart


-更新安装包列表

opkg update 


-确定网口情况

ifconfig


-LuCi Web GUI:

LuCi(http:您的设备IP)提供了用于安装其他软件包的图形用户界面(GUI)。

请注意,许多软件包有可选的LuCi GUI,但如果您需要额外的图形用户界面,通常需要安装额外的软件包。


# Haproxy 部署 & 编译 - CDN

https://abc.htmltoo.com/thread-46061.htm


http://g.htmltoo.com:802



=========插件===========在「系统」-「软件包」页面中,点击「上传软件包」=====

https://github.com/kenzok8/openwrt-packages

https://op.dllkids.xyz/

===========================================================

---修改openwrt后台登录IP

-本固件默认后台10.0.0.1, 假如我要修改为10.0.0.5

sed -i ‘s/10.0.0.1/10.0.0.5/’ /etc/config/network && /etc/init.d/network restart


cat /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 'fd58:7613:bc4f::/48'

option packet_steering '1'

config device

option name 'br-lan'

option type 'bridge'

list ports 'eth0'

config interface 'lan'

option device 'br-lan'

option proto 'static'

option ipaddr '10.0.0.1'

option netmask '255.255.255.0'

option ip6assign '60'


我们需要更改 Lan 口设置:

config interface 'lan'

        option type 'bridge'

        option ifname 'eth0'

        option proto 'static'

        option ipaddr '192.168.123.100'

        option netmask '255.255.255.0'

        option ip6assign '60'

        option gateway '192.168.123.1'

        option broadcast '192.168.123.255'

        option dns '192.168.123.1'

其中:

所有的 192.168.123.x 需要根据树莓派所处网段修改,option gateway和option dns填写路由器的 IP,若树莓派获得的 IP 为 192.168.2.154,路由器 IP 为192.168.2.1,则需要这样修改:

config interface 'lan'

        option type 'bridge'

        option ifname 'eth0'

        option proto 'static'

        option ipaddr '192.168.2.100'

        option netmask '255.255.255.0'

        option ip6assign '60'

        option gateway '192.168.2.1'

        option broadcast '192.168.2.255'

        option dns '192.168.2.1'


option ipaddr 项目定义了 OpenWrt 的 IP 地址,在完成网段设置后,IP最后一段可根据自己的爱好修改(前提是符合规则且不和现有已分配 IP 冲突)。

================================

-重启网络

/etc/init.d/network restart

-进入控制面板

若option ipaddr 的参数为 192.168.123.100,则可以在浏览器输入 http://192.168.123.100进入控制面板。

-关闭 DHCP 服务

在 “网络 - 接口 - Lan - 修改” 界面中,勾选下方的 “忽略此接口(不在此接口提供 DHCP 服务)”,并“保存&应用”

-主路由 DHCP 设置

进入路由器后台中,将主路由的 DHCP 的默认网关和 DNS 服务器设置为option ipaddr 项目中的 IP。


https://supes.top

https://mlapp.cn


签名:这个人很懒,什么也没有留下!
最新回复 (0)
返回