|
楼主 |
发表于 2019-8-28 11:26
|
显示全部楼层
本帖最后由 heq 于 2019-11-5 10:00 编辑
具体步骤
1 接线按如下
2 armbian@N1设置
2.1 vlan划分
- # vi /etc/network/interfaces
- ...
- auto eth0
- allow-hotplug eth0
- iface eth0 inet manual
- allow-hotplug wlan0
- iface wlan0 inet manual
- ...
复制代码
- # vi /etc/network/interfaces.d/bridgevlan
- auto eth0.2
- iface eth0.2 inet manual
- vlan-raw-device eth0
- up ip link set eth0.2 promisc on
- auto eth0.1
- iface eth0.1 inet manual
- vlan-raw-device eth0
- auto br-lan
- iface br-lan inet static
- address 192.168.1.254
- netmask 255.255.255.0
- gateway 192.168.1.1
- dns-nameservers 192.168.1.1
- bridge_ports eth0.1 wlan0
复制代码
2.2 导入openwrt镜像- # docker import https://downloads.openwrt.org/releases/18.06.2/targets/armvirt/64/openwrt-18.06.2-armvirt-64-default-rootfs.tar.gz openwrt:18.06.2
复制代码
2.3 可选 monitorix设置,参考monitorix监控Armbian系统状态。针对本次设置,网络接口的检测要略做调整- # vi /etc/monitorix/monitorix.conf
- eth0.11 --> eth0.2
- eth0.22 --> eth0.1
复制代码
3 WNDR4300 VLAN设置
按图示通过Luci界面进行设置
4 重启N1与WNDR4300启用VLAN
N1与WNDR4300应均能访问,WNDR4300仍然提供主路由服务,进入armbian确认vlan生效
- # ifconfig
- br-lan: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- inet 192.168.1.254 netmask 255.255.255.0 broadcast 192.168.1.255
- ...
- docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
- ...
- eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- ...
- eth0.1: flags=4419<UP,BROADCAST,RUNNING,PROMISC,MULTICAST> mtu 1500
- ...
- eth0.2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
- ...
复制代码 可以看到eth0.1与eth0.2与docker0 界面,前述设置成功,进入下一阶段的docker设置
5 armbian@N1设置
5.1 创建docker网络,注意第一条命令将把armbian IP更改为gateway指定的地址。如果两个地址不符,该命令执行完毕后armbian将会失联。- # ifconfig br-lan | grep fe80
- fe80::xxxx:xxff:fexx:xxxx
- # docker network create -d bridge --subnet=192.168.1.0/24 --gateway=192.168.1.254 --subnet=fe80::xxxx:xxff:fexx:xxxx/64 --gateway=fe80::xxxx:xxff:fexx:xxxx --ipv6 -o "com.docker.network.bridge.name"="br-lan" lanet
- # docker network create -d macvlan -o parent=eth0.2 wanet
复制代码
5.2 启动镜像,连接网络
- # docker run -d --restart always --name openwrt --network lanet --privileged --sysctl net.ipv6.conf.all.disable_ipv6=0 openwrt:18.06.2 /sbin/init
- # docker network connect wanet openwrt
- # docker start openwrt
- # docker exec -it openwrt sh
复制代码
6 进入openwrt@docker,设置PPPoE宽带拨号
- # vi /etc/config/network
- ...
- config interface 'wan'
- option ifname 'eth1'
- option proto 'pppoe'
- option username 'YOUR ACCOUNT NAME'
- option password 'YOUR PAASSWORD'
- config interface 'wan6'
- option ifname '@wan'
- option proto 'dhcpv6'
- ...
复制代码
7 进入WNDR4300,准备将主路由服务转交给N1内的docker 镜像
7.1 停止DHCP
- # vi /etc/config/dhcp
- ...
- config dhcp 'lan'
- option interface 'lan'
- option ignore '1'
- ...
复制代码
7.2 停止PPPoE服务(第3步 VLAN已限制访问,故可省略)
- # vi /etc/config/network
- ...
- #config interface 'wan'
- # option proto 'pppoe'
- # option ifname 'eth0.2'
- ...
复制代码
现在将WNDR4300与N1断电,电源重启后N1与WNDR4300应完成角色转换,N1内的OpenWRT docker镜像作为主路由提供家庭网关服务。
|
|