RADIUSdesk

logo

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
technical:openwrt-wan-network [2022/09/17 21:55]
admin [Background]
technical:openwrt-wan-network [2022/09/25 20:19] (current)
admin [Xiaomi 4A 100M]
Line 4: Line 4:
   * OpenWrt uses config files located under the **/etc/config** directory to configure the device accordingly.   * OpenWrt uses config files located under the **/etc/config** directory to configure the device accordingly.
   * The **network** file is used to define the network configuration of the device.   * The **network** file is used to define the network configuration of the device.
-  * Since we can run the MESHdesk package on basically any device that can run OpenWrt **we need to adopt the means to reach the controller so it will work on the specific device.**+  * Since we can include the MESHdesk package on basically any device that can run OpenWrt **we need to adopt the means to reach the controller so it will work on the specific device.**
   * Some devices for instance might only have one ethernet port.   * Some devices for instance might only have one ethernet port.
   * Others might have more Ethernet ports where a certain amount is grouped together and used as the LAN side and typically a single one assigned to the WAN port.   * Others might have more Ethernet ports where a certain amount is grouped together and used as the LAN side and typically a single one assigned to the WAN port.
   * For this we create the **/etc/MESHdesk/configs/wan_network** file.   * For this we create the **/etc/MESHdesk/configs/wan_network** file.
-  * This file needs to be unique to the specific device the MESHdesk package is included on.+  * This file needs to be unique to the specific device on which the MESHdesk package is included on.
   * This file will be used during startup to replace the **/etc/config/network** file in order to enable the device to reach the controller.   * This file will be used during startup to replace the **/etc/config/network** file in order to enable the device to reach the controller.
-  * The file will also be changed after the device receives its final configuration from the controller (or fallback to last known good configuration if the controller can't be reached) +  * This config will also be changed after the device receives its final configuration from the controller (or fallback to last known good configuration if the controller can't be reached) 
-  * The unique part of the configuration of wan_network involves the Ethernet port configuration and devices with can be grouped into three types. +  * The unique part of the wan_network file involves the Ethernet port configuration. Devices can be grouped into three types. 
-         - Devices with standard eth0 and or eth1 ports. //(This is typically Atheros based hardware)//+         - Devices with standard eth0 and/or eth1 ports. //(This is typically Atheros based hardware)//
          - Devices with a single eth0 port combined with swconfig to create VLANs to split the physical ports on the device up. // (This is typically older Mediatek based hardware)//          - Devices with a single eth0 port combined with swconfig to create VLANs to split the physical ports on the device up. // (This is typically older Mediatek based hardware)//
-         - New DSA style config using names like wan, lan1, lan2 lan3 etc.// (This it typically newer Mediatek devices)//+         - New DSA style config using names like wan, lan1, lan2 lan3 etc for the ports.// (This is typically newer Mediatek devices)//
  
 Next we will unpack samples of each of these types. Next we will unpack samples of each of these types.
  
 <WRAP center round tip 100%> <WRAP center round tip 100%>
-When looking at these sample files keep in mind that our aim is to use the device called **br-lan** as a bridge but instead of having the lan ports as part of **br-lan** we configure it so the **wan** port is part of it instead.+  * When looking at these sample files keep in mind that our aim is to use the //device section// called **br-lan** as a bridge
 +  * Traditionally the LAN ports will be part of it. 
 +  We however configure it now in such a way that the WAN port becomes part of it instead of the LAN ports.
 </WRAP> </WRAP>
  
Line 51: Line 53:
 </file> </file>
   * We swapped **eth0** and **eth1** as ports of **br-lan**. Plain and simple.   * We swapped **eth0** and **eth1** as ports of **br-lan**. Plain and simple.
 +  * There is no **wan** interface defined.
 +  * Devices with a single port will not need any swapping since there are only one port available.
 +  * Here's a snippet from the original **/etc/config/network** file you can compare with.
 +
 +<file bash network>
 +....
 +config device
 + option name 'br-lan'
 + option type 'bridge'
 + list ports 'eth0'
 +
 +config interface 'lan'
 + option device 'br-lan'
 + option proto 'static'
 + option ipaddr '192.168.1.1'
 + option netmask '255.255.255.0'
 + option ip6assign '60'
 +
 +config interface 'wan'
 + option device 'eth1'
 + option proto 'dhcp'
 +....
 +</file>
 +
 +
  
  
Line 150: Line 177:
   * This means that eth0.1 is now on the **WAN** port.   * This means that eth0.1 is now on the **WAN** port.
   * **client_0** and **client_1** interface sections can always be kept as is.   * **client_0** and **client_1** interface sections can always be kept as is.
-  * **lan** interface section is in actuality the **WAN** port. (This is so that we can support hardware with a single Ethernet port and to do complex bridge configurations should we need to)+  * Device **br-lan** section is in actuality now the **WAN** port. (This is so that we can support hardware with a single Ethernet port and to do complex bridge configurations should we need to)
  
  
Line 180: Line 207:
          
 </file> </file>
-  * Here you can see there is no **switch** sections and we added the **wan** port to **br-lan**. Plain and simple.+  * Here you can see there is no **switch** sections and we added the **wan** port to **br-lan** (While removing the various lan ports). Plain and simple. 
 +  * Here's a snippet from the original /etc/config/network file you can compare with. 
 + 
 +<file bash network> 
 +.... 
 +config device 
 + option name 'br-lan' 
 + option type 'bridge' 
 + list ports 'lan1' 
 + list ports 'lan2' 
 + list ports 'lan3' 
 + list ports 'lan4' 
 + 
 +config interface 'lan' 
 + option device 'br-lan' 
 + option proto 'static' 
 + option ipaddr '192.168.1.1' 
 + option netmask '255.255.255.0' 
 + option ip6assign '60' 
 + 
 +config interface 'wan' 
 + option device 'wan' 
 + option proto 'dhcp' 
 +.... 
 +</file> 
 + 
 +  * This brings us to the end of the detailed discussion of the **/etc/MESHdesk/configs/wan_network** file. 
 +  * Be sure that this file is tweaked so it will work on your hardware. 
 + 
 +====== Some Hardware Info ====== 
 +===== Xiaomi 4C ===== 
 +  * wan_network 
 +<file bash wan_network> 
 +config interface 'loopback' 
 +    option device 'lo' 
 +    option proto 'static' 
 +    option ipaddr '127.0.0.1' 
 +    option netmask '255.0.0.0' 
 +  
 +config device 
 +    option name 'br-lan' 
 +    option type 'bridge' 
 +    list ports 'eth0.1' 
 + 
 +config interface 'lan' 
 +    option device 'br-lan' 
 +    option proto 'dhcp' 
 + 
 +config interface 'client_0' 
 +    option proto 'dhcp' 
 + 
 +config interface 'client_1' 
 +    option proto 'dhcp' 
 + 
 +config switch 
 +    option name 'switch0' 
 +    option reset '1' 
 +    option enable_vlan '1' 
 + 
 +config switch_vlan 
 +    option device 'switch0' 
 +    option vlan '2' 
 +    option ports '4 2 6t' 
 + 
 +config switch_vlan 
 +    option device 'switch0' 
 +    option vlan '1' 
 +    option ports '1 6t' 
 + 
 +</file> 
 +  * hardware section 
 +<file bash meshdesk> 
 +config hardware 'xiaomi_4c' 
 + option morse_led '/sys/class/leds/blue:power/brightness' 
 + option internet_led '/sys/class/leds/yellow:power/brightness' 
 + option wifi_led 'led0' 
 +</file> 
 + 
 +===== Xiaomi 4A 100M ===== 
 +  * wan_network 
 +<file bash wan_network> 
 +config interface 'loopback' 
 + option device 'lo' 
 + option proto 'static' 
 + option ipaddr '127.0.0.1' 
 + option netmask '255.0.0.0' 
 +     
 +config device 
 + option name 'br-lan' 
 + option type 'bridge' 
 + list ports 'eth0.1' 
 + 
 +config interface 'lan' 
 + option device 'br-lan' 
 + option proto 'dhcp' 
 + 
 +config interface 'client_0' 
 +    option proto 'dhcp' 
 + 
 +config interface 'client_1' 
 +    option proto 'dhcp' 
 + 
 +config switch 
 +    option name 'switch0' 
 +    option reset '1' 
 +    option enable_vlan '1' 
 + 
 +config switch_vlan 
 +    option device 'switch0' 
 +    option vlan '1' 
 +    option ports '0 6t' 
 + 
 +config switch_vlan 
 +    option device 'switch0' 
 +    option vlan '2' 
 +    option ports '4 2 6t' 
 +</file> 
 +  * hardware section 
 +<file bash meshdesk> 
 +config hardware 'xiaomi_4a_100' 
 + option morse_led '/sys/class/leds/blue:power/brightness' 
 + option internet_led '/sys/class/leds/yellow:power/brightness' 
 + option wifi_led 'led0' 
 +</file> 
 + 
 +===== Totolink X500R (WiFi6) ===== 
 +  * wan_network 
 +<file bash wan_network> 
 +config interface 'loopback' 
 + option device 'lo' 
 + option proto 'static' 
 + option ipaddr '127.0.0.1' 
 + option netmask '255.0.0.0' 
 +  
 +config device 
 + option name 'br-lan' 
 + option type 'bridge' 
 + list ports 'wan' 
 + 
 +config interface 'lan' 
 + option device 'br-lan' 
 + option proto 'dhcp' 
 + 
 +config interface 'client_0' 
 +    option proto 'dhcp' 
 + 
 +config interface 'client_1' 
 +    option proto 'dhcp' 
 +</file> 
 +  * hardware section 
 +<file bash meshdesk> 
 +config hardware 't_x5000r' 
 + option morse_led '/sys/class/leds/blue:sys/brightness' 
 + option internet_led '/dev/null' 
 + option wifi_led 'dev:null' 
 +</file> 
 + 
 + 
 +