HELLO_wORLD
Very Senior Member
Hello,
I will describe here my experience regarding the creation of an additional SSID (on top of the main and guest ones) on a R7800 in AP mode, with @Voxel's firmware, and having it in its own VLAN.
So I have my main router (no wifi) under OpenWrt.
The router is connected with ethernet to the port WAN of the R7800 that is in AP mode.
The R7800 has the latest Voxel's firmware (V1.0.2.106SF at the time), with an ssh access set up, an external drive connected through USB.
The R7800 is able to handle up to 16 simultaneous SSIDs (see here under valid interface combinations), but the Netgear GUI only allows 4 (2&5 GHz main + 2&5 GHz guest).
The goal was to isolate the IOT devices that are using wifi from the LAN and the WAN, by putting them on a specific VLAN. This means:
Creating the VLAN tagged ethernet subinterface
First, it is important to understand that the R7800 ethernet ports are connected through an internal hardware switch.
The switch can be configured using swconfig, and by default is setup this way:
That means that the physical LAN ports and the one WAN port of the R7800 are on the same internal switch, but are isolated using internal VLANS.
Port 0 (CPU) is connected to the WAN port, and is seen as ethwan from the OS/kernel.
Ports 6 is connected to the LAN ports, and is seen as ethlan from the OS/kernel.
On the OS side, in AP mode, ethwan and ethlan are bridged together and with the standard WLAN wifi devices (ath.) under the bridge br0.
To be able to send tagged VLAN frames from the R7800 OS, the internal switch needs to be setup to forward these frames.
The internal switch only accepts VLAN id from 0 to 127, so I picked in the example VLAN id 10.
Now, we setup the internal switch:
swconfig dev switch0 vlan 10 set ports "0t 5t"
swconfig dev switch0 set apply
Now, the switch looks like this:
Now, any frame with the VLAN id tag 10 that enters from the OS will be forwarded to the WAN port and leave the switch with its tag (and the other way as well).
On the OS side, we need to create a subinterface for ethwan with VLAN id 10:
ip link add link ethwan name ethwan.10 type vlan id 10
Now, we create the dedicated bridge and add the new subinterface:
brctl addbr briot
brctl stp briot on
brctl addif briot ethwan.10
We need to give it an IP and a subnet, then bring all of this up:
ip addr add 192.168.2.2/24 dev briot
ip link set ethwan.10 up
ip link set briot up
Here I picked the subnet 192.168.2.0/24 for the IOT devices.
The router and gateway has the address 192.168.2.1 on its VLAN10 interface.
The R7800 AP has the address 192.168.2.2.
It is up to the router to deal with DHCP requests if so, and up to the router to deal with any routing/firewall between LAN and IOT zones, as well as IOT and WAN zones if needed.
The router settings are not mentioned here are they are dependent on the router and specific to one's setup.
Creating the additional WLAN wifi SSID
This part is tricky, as we need to deal with all the dni/netgear custom scripts. The device and OS are fully capable of dealing with additional SSID, but it was not taken into account when dni developed their scripts.
The idea is to insert the additional SSID configuration into /etc/config/wireless before it is used, but this file is generated by /sbin/update-wifi and some dni awk script (/etc/wifi_config_comp.awk), so changing /etc/config/wireless would not be enough.
Here is the code needing to be inserted to /etc/config/wireless:
In this example the SSID is my_iot_ssid, with the password my_password and is hidden.
To insert it at the right time, and be sure the interfaces and bridge are set up, the best way I found to do this is by modifying the script /sbin/update-wifi that is called by /sbin/wlan, and also the awk script. The next post on this thread is explaining that part.
Once /sbin/update-wifi and /etc/wifi_config_comp.awk are modified accordingly, all you need to to is
sh -c "wlan down; wlan up"
Please note that this command will interrupt the Wifi for a few seconds.
Also, it should stay after reboots. Only a firmware upgrade would reset these files, but with the automount script on a USB drive, you could automate the two files to be modified after an upgrade.
Now, any device connecting to the SSID my_iot_ssid will be in the VLAN 10 and forwarded to the router under that VLAN, separated from the other SSID and LAN devices.
Again, I use my R7800 as an AP, but this could be adapted for router mode. There would be no need to deal with the internal switch config or the ethwan.10 subinterface; briot would only have the new wlan interface, unless you plan to use one or several of the ethernet ports to have IOT devices.
I will describe here my experience regarding the creation of an additional SSID (on top of the main and guest ones) on a R7800 in AP mode, with @Voxel's firmware, and having it in its own VLAN.
So I have my main router (no wifi) under OpenWrt.
The router is connected with ethernet to the port WAN of the R7800 that is in AP mode.
The R7800 has the latest Voxel's firmware (V1.0.2.106SF at the time), with an ssh access set up, an external drive connected through USB.
The R7800 is able to handle up to 16 simultaneous SSIDs (see here under valid interface combinations), but the Netgear GUI only allows 4 (2&5 GHz main + 2&5 GHz guest).
The goal was to isolate the IOT devices that are using wifi from the LAN and the WAN, by putting them on a specific VLAN. This means:
- an ethernet subinterface with the right VLAN tag needs to be created to send VLAN tagged frames to the router (that of course is setup on its side to read such tagged frames),
- a new WLAN SSID has to be created,
- Both the ethernet VLAN sub interface and the new WLAN interface have to be on their own bridge, isolated from the main one.
Creating the VLAN tagged ethernet subinterface
First, it is important to understand that the R7800 ethernet ports are connected through an internal hardware switch.
The switch can be configured using swconfig, and by default is setup this way:
PORT | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
NAME | CPU (linked to kernel) | LAN | LAN | LAN | LAN | WAN | ? (linked to kernel) |
VLAN 1 | not member | untagged | untagged | untagged | untagged | not member | untagged |
VLAN 2 | untagged | not member | not member | not member | not member | untagged | not member |
Port 0 (CPU) is connected to the WAN port, and is seen as ethwan from the OS/kernel.
Ports 6 is connected to the LAN ports, and is seen as ethlan from the OS/kernel.
On the OS side, in AP mode, ethwan and ethlan are bridged together and with the standard WLAN wifi devices (ath.) under the bridge br0.
To be able to send tagged VLAN frames from the R7800 OS, the internal switch needs to be setup to forward these frames.
The internal switch only accepts VLAN id from 0 to 127, so I picked in the example VLAN id 10.
Now, we setup the internal switch:
swconfig dev switch0 vlan 10 set ports "0t 5t"
swconfig dev switch0 set apply
Now, the switch looks like this:
PORT | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
NAME | CPU (linked to kernel) | LAN | LAN | LAN | LAN | WAN | ? (linked to kernel) |
VLAN 1 | not member | untagged | untagged | untagged | untagged | not member | untagged |
VLAN 2 | untagged | not member | not member | not member | not member | untagged | not member |
VLAN 10 | tagged | not member | not member | not member | not member | tagged | not member |
On the OS side, we need to create a subinterface for ethwan with VLAN id 10:
ip link add link ethwan name ethwan.10 type vlan id 10
Now, we create the dedicated bridge and add the new subinterface:
brctl addbr briot
brctl stp briot on
brctl addif briot ethwan.10
We need to give it an IP and a subnet, then bring all of this up:
ip addr add 192.168.2.2/24 dev briot
ip link set ethwan.10 up
ip link set briot up
Here I picked the subnet 192.168.2.0/24 for the IOT devices.
The router and gateway has the address 192.168.2.1 on its VLAN10 interface.
The R7800 AP has the address 192.168.2.2.
It is up to the router to deal with DHCP requests if so, and up to the router to deal with any routing/firewall between LAN and IOT zones, as well as IOT and WAN zones if needed.
The router settings are not mentioned here are they are dependent on the router and specific to one's setup.
Creating the additional WLAN wifi SSID
This part is tricky, as we need to deal with all the dni/netgear custom scripts. The device and OS are fully capable of dealing with additional SSID, but it was not taken into account when dni developed their scripts.
The idea is to insert the additional SSID configuration into /etc/config/wireless before it is used, but this file is generated by /sbin/update-wifi and some dni awk script (/etc/wifi_config_comp.awk), so changing /etc/config/wireless would not be enough.
Here is the code needing to be inserted to /etc/config/wireless:
Code:
config wifi-iface 'wlg_iot'
option device 'wifi1'
option network 'lan'
option bridge 'briot'
option mode 'ap'
option ssid 'my_iot_ssid'
option encryption 'psk2'
option key 'my_password'
option hidden '1'
option rts '2347'
option frag '2346'
option wmm '1'
option countryie '0'
option short_preamble '1'
option bintval '300'
option dtim_period '2'
option doth '0'
In this example the SSID is my_iot_ssid, with the password my_password and is hidden.
To insert it at the right time, and be sure the interfaces and bridge are set up, the best way I found to do this is by modifying the script /sbin/update-wifi that is called by /sbin/wlan, and also the awk script. The next post on this thread is explaining that part.
Once /sbin/update-wifi and /etc/wifi_config_comp.awk are modified accordingly, all you need to to is
sh -c "wlan down; wlan up"
Please note that this command will interrupt the Wifi for a few seconds.
Also, it should stay after reboots. Only a firmware upgrade would reset these files, but with the automount script on a USB drive, you could automate the two files to be modified after an upgrade.
Now, any device connecting to the SSID my_iot_ssid will be in the VLAN 10 and forwarded to the router under that VLAN, separated from the other SSID and LAN devices.
Again, I use my R7800 as an AP, but this could be adapted for router mode. There would be no need to deal with the internal switch config or the ethwan.10 subinterface; briot would only have the new wlan interface, unless you plan to use one or several of the ethernet ports to have IOT devices.
Last edited: