-
Notifications
You must be signed in to change notification settings - Fork 60
Config Overview
Since there's currently a lack of read-write filesystem support for the small NOR flash footprints, the current solution is simply a 64k or 128k gzip'ed 'cpio' archive which is a subset of files in /etc to overlay at boot time.
The cpio archive is generated by the contents of /etc/cfg/manifest . So you can include arbitrary files in /etc by simply adding them to /etc/cfg/manifest before running cfg_save. Of course, please keep /etc/cfg/manifest as the first entry in /etc/cfg/manifest, or a subsequent save/load won't work.
The contents of /etc/board.cfg include the configuration partition and size (CFG_PATH and CFG_SIZE.)
- cfg_save : save config to /dev/redboot/cfg (or whichever config flash partition exists) via cpio/gz
- cfg_load : unpack config from /dev/redboot/cfg into /etc, called before startup scripts are run.
The global configuration parameters, well, control the system-level options.
- system_hostname : sets the system hostname at boot time
- kernel_modules : a list of kernel modules to load
- network_interfaces : the network interfaces to configure, in order.
The list of network interfaces is not strictly a list of actual network interfaces - it's a list of configuration file entries that start with netif_. In the examples below, anything starting with netif_NAME_ will have the NAME piece substituted with whatever is in the network_interfaces list above.
Normally it'd just be 1:1 (eg arge0, ath0, wlan0) however you can't have a '.' in the variable name or it isn't a valid variable name. So for example, you can name something arge0_1 and then in the configuration section set the name to 'arge0.1'.
Example:
system_hostname="freebsd-carambola2"
# Modules to load
kernel_modules="bridgestp if_bridge random if_vlan"
# These interfaces are configured in-order
network_interfaces="arge0 arge1 arge1_2 etherswitch0 ath0 wlan0 wlan1 bridge0"
Ethernet interfaces are configured as follows:
- netif_NAME_enable : "YES" to enable this entry
- netif_NAME_type : set to "ether" so the ether script is used
- netif_NAME_addrtype : the IPv4 address type. 'static' means static, 'none' means none.
- netif_NAME_descr : a description. This'll be used for things like SNMP information or a GUI.
- netif_NAME_name : the name of the interface itself.
Example:
netif_arge0_enable="YES"
netif_arge0_type="ether"
netif_arge0_addrtype="none"
netif_arge0_descr="default"
netif_arge0_name="arge0"
This is used to configure a physical Atheros device (athX).
- netif_NAME_enable : set to YES to enable
- netif_NAME_type : set to "ath"
- netif_NAME_descr : description
- netif_NAME_name : set to the interface name (eg ath0).
Example:
netif_ath0_enable="YES"
netif_ath0_type="ath"
netif_ath0_descr="main"
netif_ath0_name="ath0"
This configuration block configures a Wireless VAP interface.
- netif_NAME_enable : set to YES to enable
- netif_NAME_type : set to wifi
- netif_NAME_wifi_mode : "hostap" to configure a hostap VAP.
- netif_NAME_descr : description.
- netif_NAME_addrtype : IPv4 address type (static, none).
- netif_NAME_name : interface name (eg wlan0)
- netif_NAME_wifi_parent : parent physical interface (eg ath0).
- netif_NAME_wifi_channel : static channel to configure.
- netif_NAME_wifi_country : Country code (in /etc/regdomain.xml) to configure.
And for the 'hostap' mode, only a static-key WPA configuration is currently supported:
- netif_NAME_hostap_ssid : SSID to configure.
- netif_NAME_hostap_wpa_passphrase : static WPA passphrase.
- netif_NAME_hostap_wpa_mode : hostap wpa mode. WPA1=1, WPA2=2, WPA1+WPA2=3.
- netif_NAME_hostap_wpa_key_mgmt : key management. For now, only "WPA-PSK" is supported.
- netif_NAME_hostap_wpa_pairwise : supported pairwise ciphers. eg "CCMP TKIP".
Note if multiple VAPs are used, only set channel/country in the first VAP. Don't set it in subsequent VAPs or it won't work.
Example:
netif_wlan0_enable="YES"
netif_wlan0_type="wifi"
netif_wlan0_wifi_mode="hostap"
netif_wlan0_descr="default"
netif_wlan0_addrtype="none"
netif_wlan0_name="wlan0"
netif_wlan0_wifi_parent="ath0"
netif_wlan0_wifi_channel="1:ht/20"
netif_wlan0_wifi_country="US"
netif_wlan0_wifi_hostap_ssid="CACHEBOY_GOAWAYTOM"
netif_wlan0_wifi_hostap_wpa_passphrase="Sysinit891234"
netif_wlan0_wifi_hostap_wpa_mode=3
netif_wlan0_wifi_hostap_wpa_key_mgmt="WPA-PSK"
netif_wlan0_wifi_hostap_wpa_pairwise="CCMP TKIP"
This controls the ethernet bridge interfaces. Multiple bridges can be configured (bridge0, bridge1, etc.)
Ensure that you have 'if_bridge' in the 'kernel_modules' list so it is loaded if it needs to be.
- netif_NAME_enable - set to YES to enable
- netif_NAME_type - set to "bridge"
- netif_NAME_name - the actual interface name (eg bridge0)
- netif_NAME_descr - description
- netif_NAME_addrtype - IPv4 address type - 'static' or 'none'
- netif_NAME_members_stp - a space-separated list of interfaces to add which will speak STP.
- netif_NAME_members - a space-separated list of interfaces to add which will not speak STP.
Example:
# Create a bridge, flip on an IPv4 static address
netif_bridge0_type="bridge"
netif_bridge0_addrtype="static"
netif_bridge0_descr="default"
netif_bridge0_name="bridge0"
# These are bridge members w/ STP enabled
netif_bridge0_members_stp="arge0 arge1"
# These are bridge members w/ STP disabled
netif_bridge0_members="wlan0 wlan1"
netif_bridge0_ipv4_address="192.168.13.13"
netif_bridge0_ipv4_netmask="255.255.255.0"
This controls an 802.1q interface. Multiple 802.1q interfaces can be created. Ensure you have 'if_vlan' in the list of 'kernel_modules' so it is loaded if required.
Note that NAME can't have periods or other special characters in it, so use an underscore in the NAME and configure the actual interface name separately.
- netif_NAME_enable - set to YES to enable
- netif_NAME_type - set to "vlan"
- netif_NAME_descr - description
- netif_NAME_name - the actual name to clone (eg arge0.2)
- netif_NAME_vlanid - the VLAN ID for this interface (eg 2)
- netif_NAME_parent - the parent interface (eg arge0)
- netif_NAME_addrtype - the IPv4 address type, 'static' or 'none'
Example:
netif_arge1_2_enable="YES"
netif_arge1_2_type="vlan"
netif_arge1_2_name="arge1.2"
netif_arge1_2_addrtype="static"
netif_arge1_2_descr="vlan 2 testing"
netif_arge1_2_vlanid="2"
netif_arge1_2_parent="arge1"
netif_arge1_2_ipv4_address="192.168.14.13"
netif_arge1_2_ipv4_netmask="255.255.255.0"
This describes the configuration of a supported ethernet switch. Multiple etherswitch instances can be added.
The ethernet switch is configured in three parts:
- the overall configuration - dot1q, port or none;
- the vlan group configuration;
- the port configuration.
Different switches support different combinations of options. (TODO: document it and throw it up in a wiki page.) Please read the etherswitchcfg and etherswitch manpages for more information.
The top level configuration:
- netif_NAME_enable - set to "YES" to enable
- netif_NAME_type - set to "etherswitch"
- netif_NAME_mode - the etherswitch mode. 'none' is "default"; 'port' is "per-port VLAN", 'dot1q' is "802.1q VLAN."
- netif_NAME_name - the device name (eg etherswitch0.) This is the actual device name; you can't invent things here.
- netif_NAME_descr - a description.
- netif_NAME_portlist - the list of ports to configure, space separated.
- netif_NAME_vlangrouplist - the list of vlan groups to configure, space separated.
Next is the VLAN groups. 'X' in the below examples signifies a vlangroup in 'netif_NAME_vlangrouplist'.
For "none" this has no effect.
For switches that support per-port VLANs, this is typically a simple set of hard-coded VLANs (eg 1..15) where a port can be a member of one (which is configured by the port PVID, not the VLAN membership list), with a CPU/trunk port back to the host CPU.
For switches that support dot1q VLANs, this is typically a grouping of VLAN ID (1..4095) and then a list of port members, with optional 802.1q tagging. Some switches support per-port, per-vlan 802.1q tagging (which is signified as a 't' in the vlangroup port membership list); others do not.
Note: not all of the features of etherswitch are supported here - notably things like q-in-q support.
- netif_NAME_vlangroupX_vid - the VLAN ID.
- netif_NAME_vlangroupX_members - a comma separated list of member ports. 't' signifies the port should tag packets in this VLAN when transmitted. For example, '0t,1' would say 'port 0 is a member and transmitted packets are tagged, port 1 is a member.'
Next is the port configuration. 'X' below refers to a port in 'netif_NAME_portlist'.
- netif_NAME_portX_pvid - the port VLAN ID. For type "none" this has no effect. For type "port" this signifies the port VLAN the port is a member of - typically these switches only support a port being in a single VLAN. For type "dot1q" this signifies the native/untagged VLAN ID.
Example:
This is for an AR9331 embedded switch on a Carambola 2 evaluation board - it supports port and dot1q vlans, but not per-port tagged VLANs. By default the switch transmits / receives all frames on the port PVID as untagged and will transmit other VLANs as tagged.
The Carambola 2 evaluation board exposes switch ports 1 and 2 as the physical ethernet ports.
This configuration:
- is a dot1q configuration
- port0 is the CPU facing port, hooked into arge1.
- arge1.2 has been created.
- two vlan groups are created: vlangroup0 (default) is VLAN 1, vlangroup1 is VLAN 2.
- port0 is in both VLANs and is PVID 1, so VLAN 1 frames are untagged but VLAN 2 frames are tagged.
- port1 is in VLAN 1, PVID 1.
- port2 is in VLAN 2, PVID 2.
# etherswitch configuration
netif_etherswitch0_enable="YES"
netif_etherswitch0_type="etherswitch"
netif_etherswitch0_mode="dot1q"
netif_etherswitch0_name="etherswitch0"
netif_etherswitch0_descr="on-board ethernet switch"
netif_etherswitch0_portlist="0 1 2"
netif_etherswitch0_vlangrouplist="0 1"
netif_etherswitch0_vlangroup0_vid="1"
netif_etherswitch0_vlangroup0_members="0,1"
netif_etherswitch0_vlangroup1_vid="2"
netif_etherswitch0_vlangroup1_members="0,2"
netif_etherswitch0_port0_pvid="1"
netif_etherswitch0_port1_pvid="1"
netif_etherswitch0_port2_pvid="2"
/etc/cfg/manifest:
etc/cfg/manifest
etc/master.passwd
etc/group
etc/cfg/rc.conf
/etc/cfg/rc.conf:
# cat /etc/cfg/rc.conf
system_hostname="freebsd-carambola2"
# Modules to load
kernel_modules="bridgestp if_bridge random if_vlan"
# These interfaces are configured in-order
network_interfaces="arge0 arge1 arge1_2 etherswitch0 ath0 wlan0 wlan1 bridge0"
# Create arge0, no interface address
netif_arge1_enable="YES"
netif_arge1_type="ether"
netif_arge1_addrtype="none"
netif_arge1_descr="default"
netif_arge1_name="arge1"
netif_arge0_enable="YES"
netif_arge0_type="ether"
netif_arge0_addrtype="none"
netif_arge0_descr="default"
netif_arge0_name="arge0"
netif_arge1_2_enable="YES"
netif_arge1_2_type="vlan"
netif_arge1_2_name="arge1.2"
netif_arge1_2_addrtype="static"
netif_arge1_2_descr="vlan 2 testing"
netif_arge1_2_vlanid="2"
netif_arge1_2_parent="arge1"
netif_arge1_2_ipv4_address="192.168.14.13"
netif_arge1_2_ipv4_netmask="255.255.255.0"
netif_ath0_enable="YES"
netif_ath0_type="ath"
netif_ath0_descr="main"
netif_ath0_name="ath0"
netif_wlan0_enable="YES"
netif_wlan0_type="wifi"
netif_wlan0_wifi_mode="hostap"
netif_wlan0_descr="default"
netif_wlan0_addrtype="none"
netif_wlan0_name="wlan0"
netif_wlan0_wifi_parent="ath0"
# New options to code up
netif_wlan0_wifi_channel="1:ht/20"
netif_wlan0_wifi_hostap_ssid="CACHEBOY_GOAWAYTOM"
netif_wlan0_wifi_hostap_wpa_passphrase="Sysinit891234"
netif_wlan0_wifi_hostap_wpa_mode=3
netif_wlan0_wifi_hostap_wpa_key_mgmt="WPA-PSK"
netif_wlan0_wifi_hostap_wpa_pairwise="CCMP TKIP"
netif_wlan1_enable="YES"
netif_wlan1_type="wifi"
netif_wlan1_wifi_mode="hostap"
netif_wlan1_descr="default"
netif_wlan1_addrtype="none"
netif_wlan1_name="wlan1"
netif_wlan1_wifi_parent="ath0"
netif_wlan1_wifi_hostap_ssid="CACHEBOY_CARAMBOLA2"
netif_wlan1_wifi_hostap_wpa_passphrase="Sysinit891234"
netif_wlan1_wifi_hostap_wpa_mode=3
netif_wlan1_wifi_hostap_wpa_key_mgmt="WPA-PSK"
netif_wlan1_wifi_hostap_wpa_pairwise="CCMP TKIP"
# etherswitch configuration
netif_etherswitch0_enable="YES"
netif_etherswitch0_type="etherswitch"
netif_etherswitch0_mode="dot1q"
netif_etherswitch0_name="etherswitch0"
netif_etherswitch0_descr="on-board ethernet switch"
netif_etherswitch0_portlist="0 1 2"
netif_etherswitch0_vlangrouplist="0 1"
netif_etherswitch0_vlangroup0_vid="1"
netif_etherswitch0_vlangroup0_members="0,1"
netif_etherswitch0_vlangroup1_vid="2"
netif_etherswitch0_vlangroup1_members="0,2"
netif_etherswitch0_port0_pvid="1"
netif_etherswitch0_port1_pvid="1"
netif_etherswitch0_port2_pvid="2"
# Create a bridge, flip on an IPv4 static address
netif_bridge0_type="bridge"
netif_bridge0_addrtype="static"
netif_bridge0_descr="default"
netif_bridge0_name="bridge0"
# These are bridge members w/ STP enabled
netif_bridge0_members_stp="arge0 arge1"
# These are bridge members w/ STP disabled
netif_bridge0_members="wlan0 wlan1"
netif_bridge0_ipv4_address="192.168.13.13"
netif_bridge0_ipv4_netmask="255.255.255.0"
$ cat /etc/cfg/rc.conf
# Set the default system hostname
system_hostname="freebsd-carambola2"
# Modules to load
kernel_modules="bridgestp if_bridge random if_vlan"
# These interfaces are configured in-order
network_interfaces="arge0 arge1 arge1_2 etherswitch0 ath0 wlan0 wlan1 bridge0"
# Create arge0, no interface address
netif_arge1_enable="YES"
netif_arge1_type="ether"
netif_arge1_addrtype="none"
netif_arge1_descr="default"
netif_arge1_name="arge1"
netif_arge0_enable="YES"
netif_arge0_type="ether"
netif_arge0_addrtype="none"
netif_arge0_descr="default"
netif_arge0_name="arge0"
netif_arge1_2_enable="YES"
netif_arge1_2_type="vlan"
netif_arge1_2_name="arge1.2"
netif_arge1_2_addrtype="static"
netif_arge1_2_descr="vlan 2 testing"
netif_arge1_2_vlanid="2"
netif_arge1_2_parent="arge1"
netif_arge1_2_ipv4_address="192.168.14.13"
netif_arge1_2_ipv4_netmask="255.255.255.0"
netif_ath0_enable="YES"
netif_ath0_type="ath"
netif_ath0_descr="main"
netif_ath0_name="ath0"
netif_wlan0_enable="YES"
netif_wlan0_type="wifi"
netif_wlan0_wifi_mode="hostap"
netif_wlan0_descr="default"
netif_wlan0_addrtype="none"
netif_wlan0_name="wlan0"
netif_wlan0_wifi_parent="ath0"
# New options to code up
netif_wlan0_wifi_channel="1:ht/20"
netif_wlan0_wifi_hostap_ssid="CACHEBOY_GOAWAYTOM"
netif_wlan0_wifi_hostap_wpa_passphrase="Sysinit891234"
netif_wlan0_wifi_hostap_wpa_mode=3
netif_wlan0_wifi_hostap_wpa_key_mgmt="WPA-PSK"
netif_wlan0_wifi_hostap_wpa_pairwise="CCMP TKIP"
netif_wlan1_enable="YES"
netif_wlan1_type="wifi"
netif_wlan1_wifi_mode="hostap"
netif_wlan1_descr="default"
netif_wlan1_addrtype="none"
netif_wlan1_name="wlan1"
netif_wlan1_wifi_parent="ath0"
netif_wlan1_wifi_hostap_ssid="CACHEBOY_CARAMBOLA2"
netif_wlan1_wifi_hostap_wpa_passphrase="Sysinit891234"
netif_wlan1_wifi_hostap_wpa_mode=3
netif_wlan1_wifi_hostap_wpa_key_mgmt="WPA-PSK"
netif_wlan1_wifi_hostap_wpa_pairwise="CCMP TKIP"
# etherswitch configuration
netif_etherswitch0_enable="YES"
netif_etherswitch0_type="etherswitch"
netif_etherswitch0_mode="dot1q"
netif_etherswitch0_name="etherswitch0"
netif_etherswitch0_descr="on-board ethernet switch"
netif_etherswitch0_portlist="0 1 2"
netif_etherswitch0_vlangrouplist="0 1"
netif_etherswitch0_vlangroup0_vid="1"
netif_etherswitch0_vlangroup0_members="0,1"
netif_etherswitch0_vlangroup1_vid="2"
netif_etherswitch0_vlangroup1_members="0,2"
netif_etherswitch0_port0_pvid="1"
netif_etherswitch0_port1_pvid="1"
netif_etherswitch0_port2_pvid="2"
# Create a bridge, flip on an IPv4 static address
netif_bridge0_type="bridge"
netif_bridge0_addrtype="static"
netif_bridge0_descr="default"
netif_bridge0_name="bridge0"
# These are bridge members w/ STP enabled
netif_bridge0_members_stp="arge0 arge1"
# These are bridge members w/ STP disabled
netif_bridge0_members="wlan0 wlan1"
netif_bridge0_ipv4_address="192.168.13.13"
netif_bridge0_ipv4_netmask="255.255.255.0"