Skip to content

Configure the network of the AP after flashing. Prepare OpenVswitch

Jose Saldana edited this page Oct 19, 2017 · 32 revisions

Find the information about the internal structure of your router

You can find detailed information in the OpenWrt wiki.

These are two examples:

  1. Internal scheme of the TP-Link AC1750 v2 router, adapted for Wi5:

Scheme of the TP-Link AC 1750 v2 router

  1. Internal scheme of the NetGear R6100 router, adapted for Wi5:

Scheme of the Netgear R6100 router

Option 1. Using 3 cables for each AP

This is the most straightforward option, in which you will need three cables for each AP.

If you want to use a single cable with 3 VLANs, go to Option 2

Modify the configuration files

You must modify the network, firewall and wireless configuration files of your router.

Edit the content of /etc/config/network file

This is an example of what you have to put there:

  • eth0 is used for connecting via SSH (management).
  • eth1.1 is used for the control plane (192.168.1.x).
  • eth1.2 is used for the data plane (192.168.2.x).
  • eth1.3 and eth1.4 are not used in this case.
config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr '127.0.0.1'
	option netmask '255.0.0.0'

config interface 'wan'
        option ifname 'eth0'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr 'x.y.z.t'
        option gateway 'x.y.z.254'
        option broadcast 'x.y.z.255'
        option dns 'a.b.c.d'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'
        option enable_learning '0'

config switch_vlan
        option vlan '1'
        option ports '2 0t'
        option device 'switch0'

config switch_vlan
        option vlan '2'
        option ports '3 0t'
        option device 'switch0'

config switch_vlan
        option vlan '3'
        option ports '4 0t'
        option device 'switch0'

config switch_vlan
        option vlan '4'
        option ports '5 0t' #For the TPLink1750
        option ports '1 0t' #For the Netgear R6100
        option device 'switch0'

# The next 4 lines are not necessary for the Netgear R6100
config switch_vlan
        option vlan '5'
        option ports '1 6'
        option device 'switch0'

# eth1.* should be static and controlled by the controller

config interface 'lan1'
	option ifname 'eth1.1'
	option force_link '1'
	option proto 'static'
	option netmask '255.255.255.0'
	option ip6assign '60'
	option ipaddr '192.168.1.X'

config interface 'lan2'                    
        option ifname 'eth1.2'            
        option force_link '1'             
        option proto 'static'             
        option netmask '255.255.255.0'    
        option ip6assign '60'             
        option ipaddr '192.168.2.X'

config interface 'lan3'
        option ifname 'eth1.3'
        option proto 'static'
 
config interface 'lan4'
        option ifname 'eth1.4'
        option proto 'static'

If you have problems with the switch, you can use the command swconfig for getting information. Some examples:

  • Information about switch0:

      $swconfig dev switch0 show
    
  • Setting manually an VLAN in a port:

      $swconfig switch0 port 2 set pvid 1
    
  • Telling swconfig to read a configuration from a file:

     $swconfig dev switch0 load /etc/config/network
    

Edit the content of the /etc/config/firewall file

This is an example.

config defaults
        option syn_flood        1
        option input            ACCEPT
        option output           ACCEPT
        option forward          ACCEPT

Edit the content of /etc/config/wireless file

It includes an extra interface radio1, which in this case is the one used for monitoring.

Note. You have to create a mon0 and a mon1 in your wireless router. mon0 is the one that creates the AP, and mon1 is only used for monitoring purposes. In this page you have some help for this task.

Note. The channel number must be the same you put in the .cli script running in the agent.

Note. Do not use capital letters in the SSID.

Note. The AP SSIDs set in /etc/config/wireless has to be different than the SSID used for Odin/Wi5.

cconfig wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11ac'
	option path 'platform/qca955x_wmac'
	option htmode 'HT20'
	option txpower '30'
	option country 'US'
	option channel '1'
	option disabled 0

config wifi-iface
	option device 'radio0'
	option network 'lan'
	option mode 'ap'
	option encryption 'none'
	option ssid 'yourssidhere'

config wifi-device  radio1
	option type     mac80211
	option channel  11
	option hwmode	11g
	option path	'platform/ehci-platform.0/usb1/1-1/1-1:1.0'
	option htmode	HT20
	# REMOVE THIS LINE TO ENABLE WIFI:
	option disabled 0

config wifi-iface
	option device   radio1
	option network  lan
	option mode     ap
	option ssid     OpenWrt-152
	option encryption none

Option 2. Using 1 cable for each AP

  • In this case, you are configuring an out-port in the AP (the yellow LAN port number 4, which corresponds to port 5 of the internal switch) as a trunk with 3 VLANs, instead of using 3 cables.

  • You have to connect the AP to a switch which supports VLANs.

  • For using one cable, only the file /etc/config/network in set different from Option 1.

  • In addition you also have to change the Data plane interface in the start.sh script to match the one below, i.e. instead of using eth1.2, you should use eth1.data_vlan_id.

Edit the content of /etc/config/network file

You have to assign a number for each of these VLAN IDs:

  • management_vlan_id = Management VLAN ID (0-4094)
  • control_vlan_id = Control VLAN ID (0-4094)
  • data_vlan_id = Data VLAN ID (0-4094)

And substitute them in the code (for the TP-Link AC1750 v2 router):

config interface 'loopback'
        option ifname 'lo'
        option proto 'static'
        option ipaddr '127.0.0.1'
        option netmask '255.0.0.0'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1'
        option enable_learning '0'

config switch_vlan
        option vlan '1'
        option vid  'control_vlan_id'
        option ports '2 5t 0t'
        option device 'switch0'

config switch_vlan
        option vlan '2'
        option vid  'data_vlan_id'
        option ports '3 5t 0t'
        option device 'switch0'

config switch_vlan
        option vlan '3'
        option ports '4 5t 0t'
        option device 'switch0'

config switch_vlan
        option vlan '4'
        option ports '5t 0t'
        option device 'switch0'

config switch_vlan
        option vlan '5'
        option vid  'management_vlan_id'
        option ports '1 5t 6'
        option device 'switch0'

config interface 'wan'
        option ifname 'eth0'
        option proto 'static'
        option netmask '255.255.255.0'
        option ipaddr 'x.y.z.t'
        option gateway 'x.y.z.1'
        option broadcast 'x.y.z.255'
        option dns 'a.b.c.d'

config interface 'lan1'
        option ifname 'eth1.control_vlan_id'
        option force_link '1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.1.t'

config interface 'lan2'
        option ifname 'eth1.data_vlan_id'
        option force_link '1'
        option proto 'static'
        option netmask '255.255.255.0'
        option ip6assign '60'
        option ipaddr '192.168.2.t'

config interface 'lan3'
        option ifname 'eth1.3'
        option proto 'static'

config interface 'lan4'
        option ifname 'eth1.4'
        option proto 'static'
Clone this wiki locally