
Openwrt is an open-source operating system that can be used to build a custom switch for home and office use. It's a great way to have more control over your network and customize it to your needs.
One of the main advantages of using Openwrt is that it's highly customizable, allowing you to install a wide range of packages and configure your switch to suit your specific requirements. This includes setting up VPNs, firewalls, and Quality of Service (QoS) rules.
With Openwrt, you can also easily upgrade your switch's firmware, which is a major advantage over proprietary systems that can become outdated quickly. In fact, Openwrt's community-driven development process ensures that new features and bug fixes are regularly released.
To get started with building your Openwrt switch, you'll need to choose a compatible device, such as a router or a dedicated switch.
Components
OpenWrt is the operating system used in this experiment, providing the foundation for the network setup.
The Physical Router used is a TP-Link Archer C7 AC1750, which serves as the hardware backbone for the network.
Open vSwitch is a key component, allowing for virtual switching and network traffic management.
We rely on the OpenFlow protocol to manage network traffic and flow control.
Floodlight, a Java-based controller, is utilized to manage the network and provide additional functionalities beyond basic control.
On a similar theme: Network Switching Subsystem
Router Setup
To set up your router, you'll need to configure the OVS on the router. This involves creating a bridge and adding virtual ports to it. The script for this is attached, and it's essential to set up the controller correctly so it can see the traffic on the ports.
First, create a bridge called br0. Then, add the virtual ports eth1.1-1.4 to the bridge. This will allow the OVS to connect to the ports.
To connect the OVS bridge to the Linux bridge, use the tool brctl, which comes with openWrt. This will help you build a bridge between the CPU port of the router and other LAN ports.
A fresh viewpoint: Openwrt Bridge Mode
Remove the IP address of the OVS bridge and assign it to the Linux bridge. This will ensure that the OVS bridge is connected to the Linux bridge correctly.
Finally, test the network by logging into the OVS router via SSH and pinging www.google.com. This will confirm that the router itself is connected to the internet.
Configuration
To configure your OpenWrt switch, you'll want to start by setting your main LAN interface to br-lan.1, which is the default VLAN ID for the internal network.
This ensures that you don't lose connectivity to the router after applying settings.
Assigning wireless SSIDs to VLANs is also crucial, as it allows devices to connect to the correct VLAN based on the SSID they use.
A unique perspective: Openwrt Vlan
Configure Main LAN Interface
To prevent losing connectivity to the router after applying settings, set your main LAN interface to br-lan.1, as VLAN ID 1 is the default for the internal network.
A different take: Wake on Lan Openwrt
This is a crucial step in configuring your router, and it's essential to get it right to avoid any disruptions.
By setting your main LAN interface to br-lan.1, you'll ensure that you can access your router without any issues, even after applying new settings.
This configuration is specifically designed to work with the default VLAN ID 1, which is the internal network.
VLAN Configuration
To configure VLANs in OpenWrt, start by understanding the default network configuration file located at /etc/config/network. This file defines interfaces, IP addresses, DHCP service, VLANs, and more.
The default network configuration file includes a section for the local area network interface, 'lan', which has an IP address of 192.168.1.1. This interface can also be used for connecting to the OpenWrt device.
The 'config switch_vlan' sections in the file define each VLAN, specifying which ports belong to which VLAN. The VLAN ID is denoted by 'x' in "option vlan x" and can be used for flow matching.
Here's an interesting read: Openwrt Interface
To achieve our desired setup, we need to separate ports 2-6 into different VLANs and leave a 'public' channel for communication. This involves creating a new network configuration file.
In the new file, we change the IP address to 192.168.3.1 and add more 'switch_vlan' items, each with a VLAN ID from 1 to 5. Each VLAN has an '0t' port and normal ports 1-6, with 't' indicating tagged ports.
A key aspect of this configuration is the selection of port 0 as the 'public channel', which is connected to all VLANs and the CPU through eth1. This allows the CPU to see all traffic.
To create unmanaged interfaces for VLANs, add interfaces with 'ifname' of 'eth1.1'-'eth1.4' to the file, corresponding to VLAN IDs 1-4. This setup helps understand how VLANs are connected through the CPU.
To apply the new configuration, run '/etc/init.d/network restart' and be prepared for devices to reconnect to the network with new IP addresses.
For another approach, see: How to Connect My Apple Watch to a New Phone
Files and Setup
To set up your openwrt switch, you'll need to configure the OVS on the router. Create a bridge br0 and add virtual ports eth1.1-1.4 to it.
The script attached should guide you through this process, ensuring the controller can see the traffic going through the ports.
To connect the OVS bridge to the internet, use the tool brctl, which comes with openWrt. It's a great tool for building a bridge between the CPU port of the router and other LAN ports.
Configuration Files
The configuration file is a crucial part of setting up your OpenWrt router. It's where you define the interfaces, IP addresses, DHCP service, VLAN, and other essential settings. To get started, you can use a template for adding two VLANs to your OpenWrt DSA configuration.
The default network configuration file is located at /etc/config/network, and it defines the interfaces, IP addresses, DHCP service, VLAN, and more. You can see that the 'lan' interface is defined with an IP address of 192.168.1.1, and it's used for connecting OpenWrt. The 'config switch_vlan' section defines each VLAN, specifying which ports belong to which VLAN.
See what others are reading: International Packet Switched Service
If you want to separate ports 2, 3, 4, and 5 into different VLANs, you can create a new configuration file with additional 'switch_vlan' items, each with a VLAN ID from 1 to 5. Each VLAN should have an '0t' port and normal ports 1-6, with port 0 as the 'public channel' that connects all VLANs. This way, the CPU can see all the traffic.
You can also create unmanaged interfaces for each VLAN you want to use, which allows you to assign the VLANs to specific ports and devices. This is an essential step in setting up your OpenWrt router as a switch behind another router.
To assign wireless SSIDs to VLANs, you need to configure the wireless access points to connect to the correct VLAN based on the SSID they use. This ensures that wireless devices connect to the correct VLAN.
Expand your knowledge: Verizon Wireless Switch Carriers
Flash Your Router
To flash your router, you can download the firmware from the official OpenWrt site and update it through your router's GUI. Access your router by visiting http://192.168.0.1 or http://192.168.1.1, depending on your router's default gateway.
On a similar theme: Openwrt Travel Router
If your router is already flashed with OpenWrt, you can update the firmware by accessing http://192.168.1.1, which is the default gateway used by OpenWrt unless you've changed it.
You can also use this method to download the current OpenWrt as a backup of your configuration, or to duplicate the configuration to other routers.
The opkg tool is available in OpenWrt, which can be used to manage packages. However, installing OVS using opkg install OVS may not work due to some technical reasons.
If you plan to work with OpenWrt for a long time, it's recommended to build the kernel from source, similar to building a Linux Kernel Module. This will give you more control over the process and allow you to include Open vSwitch in the build.
You might enjoy: Openwrt Build System Setup
Network Overview
To start with, let's take a look at the network setup we'll be using for this guide. We're connecting wireless devices to a WRT1900ac router, specifically using the LAN1 port and leaving the WAN port empty.
The WRT1900ac router is connected to a Cisco switch, which is configured to accept VLANs. This setup is crucial for managing different network segments and prioritizing traffic.
The Cisco switch is then connected to a top-level firewall, where VLANs, DHCP, and DNS are managed. This is where the network's overall security and configuration are handled.
Here's a quick rundown of the network setup we're using:
World's Cheapest Tiny Managed Switch
The world's cheapest tiny managed switch is a game-changer for home networks and small businesses alike.
It's called the GL-AR300M, and it's a tiny powerhouse that packs a punch at an unbeatable price of under $20.
This tiny switch supports up to 16 devices and has a compact design that makes it perfect for small spaces.
It also has a built-in Wi-Fi access point, making it a great option for creating a wireless network.
The GL-AR300M is also a great option for those who want to run OpenWRT, a popular open-source operating system for routers and switches.
Discover more: Gl Inet Openwrt
Frequently Asked Questions
Is OpenWrt still used?
Yes, many router manufacturers still use OpenWrt as a base for their stock firmware. It continues to be a foundation for ongoing development of advanced networking algorithms.
Featured Images: pexels.com


