找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
广告投放联系QQ68610888
楼主: heq

[N1盒子] 【原创】Docker内OpenWRT设置成主路由,为WiFi接入的客户提供源自有线网口的网络服务

 火.. [复制链接]
发表于 2019-7-17 10:37 | 显示全部楼层
战略mark
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-21 20:02 | 显示全部楼层
Docker内OpenWRT设置成主路由,为WiFi接入的客户提供源自有线网口的网络服务

标记,感谢!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-21 23:02 | 显示全部楼层
刚刚给n1刷入armbian 5.77 Debian 5.0.2,试试docker的openwrt!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-22 17:53 来自手机 | 显示全部楼层
能不能不用有线全用无线呢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-7-23 10:06 | 显示全部楼层
牛逼,就是我想要的!
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-9-13 21:29 | 显示全部楼层
小白问下,这时候兲朝上网应该如何设置,是在armbian中还是在openwrt中?
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-10-15 09:29 | 显示全部楼层
我跟楼主那样设置了~问题是的我wifi连接的设备获取不了IP啊
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-10-29 12:14 | 显示全部楼层
能把ifconfig贴出来么?这样看不是很明白哪个对应哪个ip
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-10-29 16:05 | 显示全部楼层
我跟大大的教程做了下,分享下过程

基本IP设定可根据自己需要修改ip参数,下面IP相应修改就行
br-lan: 192.168.10.254
DOCKER OPENWRT IP: 192.168.10.1,   
eth0:上由dhcp分配IP

ARMBIAN设置

安装docker
#apt install docker.io
安装portainer
#docker volume create portainer_data
#docker run -d -p 9000:9000 -p 8000:8000 --name portainer --restart always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

启动WiFi(5G)
首先启动hostapd,可修改ssid/WiFi密码 默认是armbian/12345678
#arbmian-config
进入相应选项启动hostapd
# vi /etc/default/hostapd
DAEMON_CONF="/etc/hostapd.conf"

# vi /etc/hostapd.conf
interface=wlan0
bridge=br-lan
driver=nl80211

armbian网络设置
# vi /etc/network/interfaces

iface eth0 inet dhcp
up ip link set eth0 promisc on

# vi /etc/network/interfaces.d/bridge
auto  br-lan
iface br-lan inet static
address 192.168.10.254
netmask 255.255.255.0
gateway 192.168.10.1
dns-nameservers 192.168.10.1
bridge_ports wlan0

#vi /etc/dnsmasq.conf
interface=br-lan
#listen-address=
dhcp-option=3,192.168.10.1


拉取openwrt
#docker pull kanshudj/n1-openwrtgateway:r9.10.1
#docker network create -d bridge  --subnet 192.168.10.0/24 --gateway=192.168.10.254 -o "com.docker.network.bridge.name=br-lan" lanet
#docker run --restart always -d --name N1 --network lanet --privileged n1-openwrtgateway:r9.10.1 /sbin/init
#docker network create -d macvlan -o parent=eth0 wanet
#docker network connect wanet N1
#docker exec -it N1 sh

DOCKER(OpenWRT)设置
网络设置
# vi /etc/config/network
修改为以下内容
config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config globals 'globals'
        option ula_prefix 'fd2f:ea21:0e02::/48'

config interface 'lan'
        option type 'bridge'
        option ifname 'eth0'
        option proto 'static'
        option ipaddr '192.168.10.1'
        option netmask '255.255.255.0'
        option dns '114.114.114.114 8.8.8.8'

config interface 'virtual**0'
        option ifname 'tun0'
        option proto 'none'

config interface 'wan'
        option ifname 'eth1'
        option proto 'dhcp'

config interface 'wan6'
        option ifname '@wan'
        option proto 'dhcpv6'

最后重启N1,设置全部完成。登入N1的无线网络后,可以通过192.168.10.1访问路由器。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2019-10-29 17:55 | 显示全部楼层
两个小问题:
1 host 这侧不建议启用dnsmasq,局域网内设置openwrt(container)为唯一的DHCP与DNS服务比较好。
2 opemwrt 设置dnsmasq时不要指定nameserve,缺省情况下将用上级路由分配的nameserver,一般而言会更合适一些。

话说你设置成功了吗?docker设置有些坑要避,可以看一下我的帖。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-11-4 22:53 | 显示全部楼层
大神,你好。我完全按照你的设置,用的是armbian5.7。n1连接主路由Lan口,然后我用192.168.1.254登入armbian系统后,输入 vi /etc/resolv.conf  出现两个nameservers。
一个是我按照教程设定的,还有一个是我主路由的ip。虽然连接ARMBIAN wifi可以正常上网,但我想知道,这会报什么bug吗?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

 楼主| 发表于 2019-11-5 09:47 | 显示全部楼层
1 主路由IP作为nameserver仅当N1挂在其下才有意义,到了其它网络环境这个nameserver 将无效。
2 192.168.1.1指向内部docker内建立的DNS,必须保留。

我自己的惨痛经历:N1带到酒店里死活不能上网,排错排到怀疑人生
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-11-15 11:57 | 显示全部楼层
我用你的方法死活分配不上ip,只能另外想出这个办法了dnsmasq直接指定网关,armbian直接转发流量
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2019-12-3 00:02 | 显示全部楼层
非常感谢,按照说明配置成功了。
我看你另外一个帖子通过vlan配置为主路由里,是可以支持ipv6的,这个wifi方案也可以支持吗?能不能加上去,再次感谢
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

发表于 2020-2-10 05:39 来自手机 | 显示全部楼层
谢谢大神,我一直想实现类似效果。之前的想法是通过net=host等方式,让docker容器里的op直接识别网卡开启ap,看来不行,而且每次启动host模式时候宿主就断连。楼主的思路确实让我耳目一新柳暗花明。
我的恩山、我的无线 The best wifi forum is right here.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

有疑问请添加管理员QQ86788181|手机版|小黑屋|Archiver|恩山无线论坛(常州市恩山计算机开发有限公司版权所有) ( 苏ICP备05084872号 )

GMT+8, 2024-4-19 09:04

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

| 江苏省互联网有害信息举报中心 举报信箱:js12377 | @jischina.com.cn 举报电话:025-88802724 本站不良内容举报信箱:68610888@qq.com 举报电话:0519-86695797

快速回复 返回顶部 返回列表