Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Allow routing on top of AP-client links, keep general and specific wifi settings separate, fix #415 #551

Closed
wants to merge 11 commits into from
Closed
128 changes: 99 additions & 29 deletions packages/lime-docs/files/lime-example
Expand Up @@ -27,8 +27,6 @@ config lime network
option anygw_dhcp_start '2' # First IP in the subnet to be used for DHCP for clients. For example, if the subnet is 10.x.0.0/16 and you want the clients to get an IPv4 from a DHCP pool starting from 10.x.100.2, the start parameter will have to be 100 * 256 + 2 = 25602.
option anygw_dhcp_limit '0' # Number of IPs available for DHCP. Use zero for having the DHCP pool ranging from anygw_dhcp_start up to the end of the subnet. For example, if the subnet is 10.x.0.0/16, the start of the DHCP pool is at 10.x.100.2 and you want the DHCP pool to finish at 10.x.127.254, the limit parameter will have to be (127 - 100) * 256 + (254 - 2) + 1 = 7165. Instead, if you want the DHCP pool to go from 10.x.100.2 up to 10.x.255.254 (last valid IPv4 in the /16 subnet) you can just set the limit to zero.
option main_ipv6_address '2a00:1508:0a%N1:%N200::/64' # Parametrizable in the same way as main_ipv4_address. If used, the IP autocompletion will fill maximum the last 24 bits, so specifying an IP autocompletion range bigger than /104 is not useful.
option bmx6_mtu '1500' # Set MTU for bmx6 tunnel interfaces
# option bmx6_pref_gw 'gw_hostname' # Force bmx6 to use a specific gateway to Internet (hostname must be used as identifier)
list protocols ieee80211s # List of protocols configured by LiMe, some of these require the relative package "lime-proto-...". Note that if you set here some protocols, you overwrite the *whole* list of protocols set in /etc/config/lime-defaults
list protocols lan
list protocols anygw
Expand All @@ -38,37 +36,55 @@ config lime network
list protocols olsr:14
list protocols olsr6:15
list protocols olsr2:16
lisr protocols babeld:17
list protocols bmx7:18
list resolvers 4.2.2.2 # b.resolvers.Level3.net # DNS servers node will use
list resolvers 141.1.1.1 # cns1.cw.net # Set every entry empty for using the upstream (ISP) DNS server
list resolvers 2001:470:20::2 # ordns.he.net
option bmx6_mtu '1500' # Set MTU for bmx6 tunnel interfaces
option bmx6_publish_ownip false
option bmx6_over_batman false # Disables Bmx6 meshing on top of batman
option bmx6_pref_gw none
option bmx6_pref_gw none # Force bmx6 to use a specific gateway to Internet (hostname must be used as identifier)
option bmx6_wifi_rate_max 54000000
option bmx7_mtu '1500' # Set MTU for bmx7 tunnel interfaces
option bmx7_publish_ownip false
option bmx7_over_batman false
option bmx7_pref_gw none # Force bmx6 to use a specific gateway to Internet (hostname must be used as identifier)
option bmx7_wifi_rate_max 'auto'
option anygw_mac 'aa:aa:aa:%N1:%N2:aa' # Parametrizable with %Nn. Keep in mind that the ebtables rule will use a mask of ff:ff:ff:00:00:00 so br-lan will not forward anything coming in that matches the first 3 bytes of it's own anygw_mac (aa:aa:aa: by default)
# option autoap_enabled 0 # Requires lime-ap-watchping installed. If enabled AP SSID is changed to ERROR when network issues
# option autoap_hosts "8.8.8.8 141.1.1.1" # Requires lime-ap-watchping installed. Hosts used to check if the network is working fine
option use_odhcpd false

### WiFi general options

config lime wifi
# option country 'ES'
option channel_2ghz '11' # May be either a list or a single option, in case of a list channel will be selected according to radio index
option channel_5ghz '48' # Check for allowed channels on https://en.wikipedia.org/wiki/List_of_WLAN_channels#regulatory_tables5.0ghz
# option country 'ES' # set this to your location countrycode, for example in Spain, setting ES allows you to use channel 13
option channel_2ghz '11' # May be either a list or a single option, in case of a list channel will be selected according to radio index
# option channel_5ghz '48' # Check for allowed channels on https://en.wikipedia.org/wiki/List_of_WLAN_channels#regulatory_tables5.0ghz
list channel_5ghz '157' # Use the fist channel in the list for the first 5 GHz radio
list channel_5ghz '48' # Use the second channel in the list for the second 5 GHz radio
# option htmode_2ghz 'HT20'
option htmode_5ghz 'HT40'
option distance_2ghz '100' # Distance between the ap and the furthest client in meters
option distance_5ghz '1000' # Distance between this node and the furthest connected node in meters
list modes 'ap' # You can specify if the mode is applied to all radios or just some particular type, for example apname_2ghz and adhoc_5ghz to have an access point in 2ghz and the adhoc in 5ghz. These suffixes (_2ghz and _5ghz) work for all modes
option distance_2ghz '100' # Distance between the ap and the furthest client in meters, heavily affects performances
option distance_5ghz '1000' # Distance between this node and the furthest connected node in meters, heavily affects performances
list modes 'ap' # You can specify if the mode is applied to all radios or just some particular type, for example apname_2ghz and adhoc_5ghz to have an access point in 2ghz and the adhoc in 5ghz. These suffixes (_2ghz and _5ghz) work for all modes
list modes 'apname'
list modes 'ieee80211s'
# list modes 'adhoc' # See below for adhoc configuration
# list modes 'client' # See below for client configuration
option ap_ssid 'LibreMesh.org'
option ap_ssid 'LibreMesh.org' # set here your network name, **this value is required even if AP is not used**, as it is used for calculating fields with %N1, %N2, %N3
option ap_network 'lan' # for normal usage (non-LibreMesh client devices associating to this AP), AP has to be in a bridge (br-lan) with the cabled interfaces
# option ap_key 'SomeWPA2PskKey'
# option ap_encryption 'psk2'
option apname_ssid 'LibreMesh.org/%H'
option apname_ssid 'LibreMesh.org/%H' # a user can connect to the named AP for avoiding roaming
option apname_network 'lan' # for normal usage (non-LibreMesh client devices associating to this AP), APname has to be in a bridge (br-lan) with the cabled interfaces
# option apname_key 'SomeWPA2PskKey'
# option apname_encryption 'psk2'
# option adhoc_ssid 'LiMe' # adhoc configuration
# option adhoc_bssid 'ca:fe:00:c0:ff:ee'
# option adhoc_mcast_rate_2ghz '24000'
# option adhoc_mcast_rate_5ghz '6000'
option ieee80211s_mesh_fwding '0' # Settings needed only for 802.11s
option ieee80211s_mesh_id 'LiMe'
# option ieee80211s_encryption 'psk2/aes' # in order to use encrypted mesh, the wpad-mini package have to be replaced with wpad-mesh package either manually or by the selected network-profile
Expand All @@ -79,25 +95,36 @@ config lime wifi

### WiFi interface specific options ( override defaults options )

## use radio0 only for mesh
config wifi radio0 # you should ensure that the chosen radio name exists, for example with "wifi status" command
## use radio99 only for mesh
config wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
list modes 'ieee80211s'
# option country 'ES'
option channel '11'
option distance '1000'
option ieee80211s_mesh_fwding '0'
option ieee80211s_mesh_id 'LiMe'

## change ssid for radio1
config wifi radio1 # you should ensure that the chosen radio name exists, for example with "wifi status" command
## change ssid for radio99 and use it just for AP
config wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
list modes 'ap'
option ap_ssid 'Special'
# option country 'ES'
option channel '11'
option distance '1000'
option ap_network 'lan'

## diable lime-config for radio2
config wifi radio2 # you should ensure that the chosen radio name exists, for example with "wifi status" command
## disable lime-config for radio99
config wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
option modes 'manual' # If you use manual protocol you must not specify other protocol, or your configuration will be broken!


## set radio3 to adhoc with specific channel
config wifi radio3 # you should ensure that the chosen radio name exists, for example with "wifi status" command
## set radio99 to do just adhoc with specific channel
config wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
list modes 'adhoc'
option channel_2ghz '1'
option channel_5ghz '48'
option adhoc_ssid 'LiMe' # Parametrizable with %M, %H
# option country 'ES'
option channel '1'
option distance '1000'
option adhoc_ssid 'LiMe'
option adhoc_bssid 'ca:fe:00:c0:ff:ee'
option adhoc_mcast_rate_2ghz '24000'
option adhoc_mcast_rate_5ghz '6000'
Expand All @@ -106,10 +133,10 @@ config wifi radio3 # you should ensure that the chosen radio name exists, for ex
# you need two pieces of configuration the wifi specific configuration and the
# network specific one like in the following example.

## set radio4 as client of access point for internet access, both the following "wifi" and "net" sections are required
option wifi radio4 # you should ensure that the chosen radio name exists, for example with "wifi status" command
## set radio99 as client of access point for internet access, both the following "wifi" and "net" sections are required
option wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
list modes 'client'
option channel_2ghz 'auto'
option channel 'auto'
option client_ssid 'SomeWiFiNetwork'
option client_key 'SomeWPApskPassword'
option client_encryption 'psk' # psk for WPA or psk2 for WPA2
Expand All @@ -119,17 +146,60 @@ config net wirelessclientWAN
option linux_name 'wlan0-sta' # the client interface name could be named differently, like wlan1-sta
list protocols 'wan' # use wan to get Internet connectivity via DHCP

## set radio5 as client of an access point part of the LibreMesh network, both the following "wifi" and "net" sections are required
option wifi radio5 # you should ensure that the chosen radio name exists, for example with "wifi status" command
## set radio99 as client of an access point part of the LibreMesh network using BMX6, no specific configuration is needed on the AP, both the following "wifi" and "net" sections are required
option wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
list modes 'client'
option channel_2ghz 'auto'
option channel 'auto'
option client_ssid 'LibreMesh.org'
option distance 1000 # maximum distance to AP, heavily affects performances

config net wirelessclientBackbone
option linux_name 'wlan0-sta' # the client interface name could be named differently, like wlan1-sta
list protocols 'client' # needed for setting up the new interface
list protocols 'bmx6:0' # use BMX6 routing on client interface. The :0 is needed for disabling the VLAN, as the AP usually does not have VLAN. In case VLAN is needed, it has to be set also as specific AP configuration, not implemented. LAN is not supported by wireless drivers. BATMAN-adv would need specific AP configuration, not implemented. Having both BMX6 and BATMAN-adv is hindered by the fact that BMX6 sets the proto of the interface as static.
list protocols 'bmx6:0' # use BMX6 routing on client interface. The :0 is needed for disabling the VLAN, as the AP usually does not have VLAN. Client interface in LAN bridge is not supported by wireless drivers.

## set radio99 as client of an access point part of the LibreMesh network using Babeld and BATMAN-adv, specific configuration is needed both on the AP and on the client, for each, both a "wifi" and a "net" sections are required

# on the AP:
config wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
# list modes 'ap' # include this if you additionally want an AP for clients
list modes 'apname'
# list modes 'ieee80211s' # include this if you additionally want also do IEEE802.11s mesh on the same radio
option apname_ssid 'backbone/%H' # clients should not connect to this AP, SSID name should point it out
# option apname_key 'somePassword'
# option apname_encryption 'psk2'
option country 'ES'
option channel '11'
option distance '1000' # maximum distance from clients, heavily affects performances
# option ap_ssid 'LibreMesh.org'
# option ap_key 'somePassword'
# option ap_encryption 'psk2'
# option ap_network 'lan' # if you use this radio also for clients, specify to include the interface for clients in the br-lan LAN bridge
# for this usecase, do NOT use anything like: option apname_network 'lan', as this apname interface has to be used only for Babeld and BATMAN-adv and should not be included in the LAN bridge
# option ieee80211s_mesh_id 'LiMe'
# option ieee80211s_mesh_fwding '0'

config net backboneAP
option linux_name 'wlan0-apname' # verify the name, the APname interface name could be named differently, like wlan1-apname
list protocols 'apname' # needed for setting up the interface
list protocols 'babeld:17'
list protocols 'batadv:%N1'

# on the client:
option wifi radio99 # you should ensure that the chosen radio name exists, for example with "wifi status" command, likely radio0 or radio1
list modes 'client'
option country 'ES'
option channel 'auto'
option distance '1000' # maximum distance from AP, heavily affects performances
option client_ssid 'backbone/ddeeff' # specify here the name of the AP interface you want to connect for joining the LibreMesh network and you specifically configured for this
# option client_key 'somePassword'
# option client_encryption 'psk2'

config net backboneClient
option linux_name 'wlan0-sta' # verify the name, the client interface name could be named differently, like wlan1-sta
list protocols 'client' # needed for setting up the new interface
list protocols 'babeld:17'
list protocols 'batadv:%N1'

### Network interface specific options ( override general option )
### Available protocols: bmx6, bmx7, batadv, olsr, olsr6, olsr2, bgp, wan, lan, manual, static
Expand Down
2 changes: 2 additions & 0 deletions packages/lime-system/files/etc/config/lime-defaults-factory
Expand Up @@ -54,7 +54,9 @@ config lime wifi
list modes 'apname'
list modes 'ieee80211s'
option ap_ssid 'LibreMesh.org'
option ap_network 'lan'
option apname_ssid 'LibreMesh.org/%H'
option apname_network 'lan'
option adhoc_ssid 'LiMe'
option adhoc_bssid 'ca:fe:00:c0:ff:ee'
option adhoc_mcast_rate_2ghz '24000'
Expand Down
1 change: 0 additions & 1 deletion packages/lime-system/files/usr/lib/lua/lime/mode/ap.lua
Expand Up @@ -7,7 +7,6 @@ ap.wifi_mode="ap"
function ap.setup_radio(radio, args)
--! checks("table", "?table")

args["network"] = "lan"
return wireless.createBaseWirelessIface(radio, ap.wifi_mode, nil, args)
end

Expand Down
Expand Up @@ -7,7 +7,6 @@ ap.wifi_mode="ap"
function ap.setup_radio(radio, args)
--! checks("table", "?table")

args["network"] = "lan"
return wireless.createBaseWirelessIface(radio, ap.wifi_mode, "name", args)
end

Expand Down
3 changes: 0 additions & 3 deletions packages/lime-system/files/usr/lib/lua/lime/proto/adhoc.lua
Expand Up @@ -4,10 +4,7 @@ local adhoc_mode = require("lime.mode.adhoc")

local adhoc = {}

adhoc.configured = false

function adhoc.configure(args)
adhoc.configured = true
end

function adhoc.setup_interface(ifname, args)
Expand Down
28 changes: 28 additions & 0 deletions packages/lime-system/files/usr/lib/lua/lime/proto/ap.lua
@@ -0,0 +1,28 @@
#!/usr/bin/lua

local ap_mode = require("lime.mode.ap")

local ap = {}

function ap.configure(args)
end

function ap.setup_interface(ifname, args)
if ifname:match("^wlan%d+."..ap_mode.wifi_mode.."$") then
local libuci = require "uci"
local uci = libuci:cursor()

--! sanitize passed ifname for constructing uci section name
--! because only alphanumeric and underscores are allowed
local networkInterfaceName = network.limeIfNamePrefix..ifname:gsub("[^%w_]", "_")

uci:set("network", networkInterfaceName, "interface")
uci:set("network", networkInterfaceName, "proto", "none")
uci:set("network", networkInterfaceName, "mtu", "1536")
uci:set("network", networkInterfaceName, "auto", "1")

uci:save("network")
end
end

return ap
28 changes: 28 additions & 0 deletions packages/lime-system/files/usr/lib/lua/lime/proto/apname.lua
@@ -0,0 +1,28 @@
#!/usr/bin/lua

local apname_mode = require("lime.mode.apname")

local apname = {}

function apname.configure(args)
end

function apname.setup_interface(ifname, args)
if ifname:match("^wlan%d+."..apname_mode.wifi_mode.."name$") then
local libuci = require "uci"
local uci = libuci:cursor()

--! sanitize passed ifname for constructing uci section name
--! because only alphanumeric and underscores are allowed
local networkInterfaceName = network.limeIfNamePrefix..ifname:gsub("[^%w_]", "_")

uci:set("network", networkInterfaceName, "interface")
uci:set("network", networkInterfaceName, "proto", "none")
uci:set("network", networkInterfaceName, "mtu", "1536")
uci:set("network", networkInterfaceName, "auto", "1")

uci:save("network")
end
end

return apname
3 changes: 0 additions & 3 deletions packages/lime-system/files/usr/lib/lua/lime/proto/client.lua
Expand Up @@ -4,10 +4,7 @@ local client_mode = require("lime.mode.client")

local client = {}

client.configured = false

function client.configure(args)
client.configured = true
end

function client.setup_interface(ifname, args)
Expand Down
Expand Up @@ -4,10 +4,7 @@ local ieee80211s_mode = require("lime.mode.ieee80211s")

local ieee80211s = {}

ieee80211s.configured = false

function ieee80211s.configure(args)
ieee80211s.configured = true
end

function ieee80211s.setup_interface(ifname, args)
Expand Down
4 changes: 0 additions & 4 deletions packages/lime-system/files/usr/lib/lua/lime/proto/static.lua
Expand Up @@ -6,11 +6,7 @@ local config = require("lime.config")

static = {}

static.configured = false

function static.configure(args)
if static.configured then return end
static.configured = true
end

function static.setup_interface(ifname, args)
Expand Down
2 changes: 1 addition & 1 deletion packages/lime-system/files/usr/lib/lua/lime/wireless.lua
Expand Up @@ -86,7 +86,7 @@ function wireless.configure()

if specRadio then
modes = specRadio["modes"]
options = utils.tableMelt(options, specRadio)
options = specRadio
end

--! If manual mode is used toghether with other modes it results in an
Expand Down