最近搞了一条联通宽带,作为家里的备用宽带。咸鱼收了个 RAX3000M 作为路由器,刷了ImmortalWrt。
它有 4 个网口,但我只用了 1 个网口连接光猫,其他 3 个网口闲置着。
于是我就想利用起来其中一个闲置的 lan3 网口,把它作为 AP 使用。
1. 配置网络
首先是把 lan3 网口从 lan 口桥接中移除,然后创建一个新的网桥br-ap
,把 lan3 网口加入到这个网桥中。
然后把 br-ap 加入到新建的接口中,配置好 IP 地址和网关。这里我采用了静态 ip 的方式,方便做路由。
1 2 3 4 5 6 7 8 9 10 11 12
| config interface 'larkin_lan' option proto 'static' option device 'br-ap' option ipaddr '10.0.0.19' option netmask '255.255.255.0' option gateway '10.0.0.1' option defaultroute '0'
config device option type 'bridge' option name 'br-ap' list ports 'lan3'
|
2. 配置路由
为了让 AP 能够访问主路由,需要配置路由表。
1 2 3 4
| config route option interface 'lan' option target '10.0.0.0/24' option gateway '10.0.0.19'
|
3. 配置防火墙
防火墙配置里,需要把新建的接口larkin_lan
加入到防火墙中,并允许转发。
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| config zone option name 'larkin_lan' list network 'larkin_lan' option input 'ACCEPT' option output 'ACCEPT' option forward 'ACCEPT'
config forwarding option src 'lan' option dest 'larkin_lan'
config forwarding option src 'larkin_lan' option dest 'lan'
|
4. 配置无线
无线的配置就比较简单了,只需要把无线接口绑定到larkin_lan
上即可。
1 2 3 4 5 6 7
| config wifi-iface 'default_radio0' option device 'radio0' option mode 'ap' option ssid 'Larkin_W6' option encryption 'sae-mixed' option key '12345678' option network 'larkin_lan'
|
5. 主路由配置访问副路由的路由
在主路由上添加一条静态路由,指向副路由的网关,这里就用的是副路由指定的静态 ip。
1 2 3 4
| config route option interface 'lan' option target '10.100.0.1/24' option gateway '10.0.0.19'
|