-1

I flashed OpenWrt + Open Vswitch on a router: TP-link AC1750

I want to add a controller (floodlight) listens on the router and all devices connected to the wireless network can be seen on floodlight.

I have read the document on openwrt.org to learn the terms about the configuration file: /etc/config/network. But I still have some basic questions hope anyone can help me out. Thanks!

  1. What is the device of Wifi? Is it wan/wan6?
  2. What is br-lan in ifconfig output? Why its ip is 192.168.1.1? Does this mean any devices connected by wireless network are connected to br-lan? And I don’t know where to find the configuration of it.
  3. On the architecture of the router in the picture, why br-lan is bridge between wifi and eth1? In the default configuration file, wan/wan6 should be on eth0, right? I’m kinda confused by comparing them.
  4. I add a bridge named ‘mybridge’ with ove-vsctl. But when I add port on it with ovs-vsctl add-port mybridge {wlan0, eth1}, there is error reported? But if I add eth0, there is no error anymore.

Because only ovs bridge can be listened by controller, I believe I have to use ovs-vsctl create a bridge to replace the function of br-lan. But I don’t know where to start. Except questions above, anybody could show me the direction to do this please? Thanks.

The ifconfig output:

br-lan    Link encap:Ethernet  HWaddr A4:2B:B0:DC:64:34
          inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fd40:41e7:b9c0::1/60 Scope:Global
          inet6 addr: fe80::a62b:b0ff:fedc:6434/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:151654 errors:0 dropped:0 overruns:0 frame:0
          TX packets:236631 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:15601422 (14.8 MiB)  TX bytes:251291293 (239.6 MiB)

eth0      Link encap:Ethernet  HWaddr A4:2B:B0:DC:64:35
          inet addr:192.168.0.106  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::a62b:b0ff:fedc:6435/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1083749 errors:0 dropped:0 overruns:0 frame:0
          TX packets:150544 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:433298836 (413.2 MiB)  TX bytes:18665423 (17.7 MiB)
          Interrupt:4

eth1      Link encap:Ethernet  HWaddr A4:2B:B0:DC:64:34
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9727 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:335 (335.0 B)  TX bytes:676714 (660.8 KiB)
          Interrupt:5

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:905 errors:0 dropped:0 overruns:0 frame:0
          TX packets:905 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:85370 (83.3 KiB)  TX bytes:85370 (83.3 KiB)

wlan0     Link encap:Ethernet  HWaddr A4:2B:B0:DC:64:33
          inet6 addr: fe80::a62b:b0ff:fedc:6433/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:153653 errors:0 dropped:0 overruns:0 frame:0
          TX packets:223631 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:17983679 (17.1 MiB)  TX bytes:256128206 (244.2 MiB)

The default /etc/config/network:

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

config globals 'globals'
        option ula_prefix 'fd40:41e7:b9c0::/48'

config interface 'lan'
        option ifname 'eth1'
        option force_link '1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

config interface 'wan'
        option ifname 'eth0'
        option proto 'dhcp'

config interface 'wan6'
        option ifname 'eth0'
        option proto 'dhcpv6'

config switch
        option name 'switch0'
        option reset '1'
        option enable_vlan '1 2'
        
config switch_vlan
        option device 'switch0'
        option vlan '1'
        option ports '0 2 3 4 5'

config switch_vlan
        option device 'switch0'
        option vlan '2'
        option ports '1 6'

The structure of the router:

Default figure of the router

Leo
  • 1
  • 1
  • 3
  • Could you add a link to the document you're citing? For your new bridge, what it the error reported? Where is it reported? Why do you think you have to create a new bridge? When you mention the documentation of br-lan, what exactly are you looking for? – pchaigno Aug 27 '17 at 19:19
  • @pchaigno Sorry for the late. When I add eth1 port to 'mybridge', it reports 'ovs-vsctl: Error detected while setting up 'eth1'. See ovs-vswitchd log for details.' Because I want to use floodlight on the ovs router, so I think I have to create a new OVS bridge to set controller on it. br-lan is the default bridge of wifi and eth1 port just like the figure I attached. Because I want to make all devices connect to 'mybridge' by wireless network and are able to connect to the internet, perhaps I need to add wlan0 and eth1 to 'mybridge'? I tried but didn't work. I don't know how to do next.. – Leo Aug 28 '17 at 00:37
  • What's the error message in the ovs-vswitchd log? Why not use the br-lan bridge and set the controller on it? – pchaigno Aug 28 '17 at 05:05
  • @pchaigno I googled the log file should be located at var/log/ovs-vswitchd but I cannot find it. I have to create another bridge because br-lan cannot connect to a remote controller. Maybe there is a way but I don't know how to. But I can do it on OVS bridge witch: ovs-vsctl set-controller mybridge tcp:ip:port – Leo Aug 28 '17 at 14:26
  • What does it say if you try to connect br-lan to a remote controller? Try `/usr/local/var/log/openvswitch/ovs-vswitchd.log` and `/var/log/openvswitch/ovs-vswitchd.log` for the log file. – pchaigno Aug 28 '17 at 14:33
  • @pchaigno I didn't find the directories you mentioned. Maybe I have to manually create the log files. But I figured the problem out. Because br-lan is not a ovs bridge, I cannot use ovs-vsctl command to set it up. The steps I attached as an answer. Thank you so much for your help. – Leo Aug 28 '17 at 15:10

1 Answers1

-1

I figured it out. Here is the steps:

I created a new bridge by

ovs-vsctl add-br mybridge

Then I compared /etc/config/wireless and /etc/config/network, I found wireless device is connected to interface 'lan' and 'eth1', just like the figure I attacked above. So I think interface 'lan' could equal to 'br-lan' to some extent. Then in /etc/config/network, I modified:

config interface 'lan'
        option ifname 'eth1 mybridge'
        option force_link '1'
        option type 'bridge'
        option proto 'static'
        option ipaddr '192.168.1.1'
        option netmask '255.255.255.0'
        option ip6assign '60'

And set controller on 'mybridge' by:

ovs-vsctl set-controller mybridge tcp:ip:port

Finally I can see the devices connected to the router on controller side and push flows about the devices.

Leo
  • 1
  • 1
  • 3