OK1046A-C Development Board VLAN Configuration Guide
I. Overview
VLAN Concept: Virtual Local Area Network, which creates multiple ''virtual'' mini-switches on a single physical switch. Each mini-switch, or VLAN, acts as a separate broadcast domain, isolating network traffic between them at Layer 2 (the data link layer), similar to how they would operate if connected to different physical switches.
To implement this functionality, the key is to insert a 4-byte VLAN tag into a standard Ethernet frame. This tag includes a 12-bit VLAN ID that identifies the specific VLAN to which the frame belongs. Devices that support VLANs use this ID to differentiate and manage traffic from various virtual local area networks (VLANs).
II. Configuration Steps
1. Create a VLAN Virtual Interface
This file is used to create a virtual VLAN network device at system startup. In this case, "Name=vlan100" is the name assigned to the VLAN interface, and "Id=100" is the VLAN ID.
root@localhost:~# vi /etc/systemd/network/vlan100.netdev [NetDev] Name=vlan100 Kind=vlan [VLAN] Id=100
2. Configure the IP Address for the VLAN Interface
This file is used to assign IP addresses to the VLAN device that was created previously and to activate the configuration. If the VLAN needs to access an external network, you can configure a gateway. For example: Gateway=192.168.0.1.
root@localhost:~# vi /etc/systemd/network/vlan100.network [Match] Name=vlan100 [Network] Address=192.168.0.70/24
3. Configure the Parent Interface
To enable VLAN traffic to pass through the physical network interface card, make sure that the parent interface (i.e. fm1-mac3) is active but does not have an IP address assigned to it (unless the interface has the IP address of the native VLAN). This step is very important as it informs the systemd-networkd network service that the primary function of the fm1-mac3 interface is to carry VLAN vlan100.
root@localhost:~# vi /etc/systemd/network/fm1-mac3.network [Match] Name=fm1-mac3 [Network] VLAN=vlan100 # Key Point: Do not configure an IP address; instead, declare that this interface carries VLANs. # If the physical interface needs to carry multiple VLANs in the topology, write: VLAN=vlan100,vlan200
4. Apply the Configuration
After creating the configuration files, restart the systemd-networkd service to activate the settings.
root@localhost:~# systemctl restart systemd-networkd
III. Verification
1. Configuration Information Declaration
VLAN configuration for Development Board 1
VLAN configuration for Development Board 2
2. Same VLAN ID Test
Now, connect the two network ports (192.168.0.78 and 192.168.0.70), which both have a VLAN ID of 100, directly using an Ethernet cable. Test them by pinging each other.
3. Different VLAN ID Test
The test shows that even IP addresses within the same subnet cannot respond to each other if their VLAN IDs differ.
In summary, testing VLAN functionality requires creating a virtual VLAN interface and linking it to a physically existing network port. This physical port can carry multiple VLAN interfaces. Subsequently, configure different VLAN IDs as needed to verify VLAN behavior.
IV. Capturing Packets to View VLAN Tags
When devices with the same VLAN ID communicate, the VLAN-tagged data frames can also be observed using tcpdump, as shown in the image below.
1. VLAN Identifier
The prominent vlan 100 in each line clearly indicates that the packet belongs to the virtual LAN with VLAN ID 100.
2. 802.1Q Tag
The ethertype 802.1Q (0x8100) in each line indicates that the Ethernet frame uses the 802.1Q protocol, which is the IEEE-defined standard for VLAN tagging. The hexadecimal value 0x8100 is the ''TPID'' embedded in the Ethernet frame header, signaling to network devices that ''this frame carries a VLAN tag.''
V. Setting VLAN ID on a PC
If you need to perform VLAN testing between a Windows PC and the development board, follow these steps to manually specify the VLAN ID for the network adapter:
1. Access Network Connections
Open the Control Panel, go to ''Network and Sharing Center,'' and click ''Change Adapter Settings'' on the left. Locate the physical network interface card connected to the development board.
2. Open ''Network Card Properties''
Right-click the network adapter icon and select ''Properties.'' In the pop-up window, click the ''Configure (C)...'' button.
3. Edit ''Advanced Settings''
In the network adapter settings window, switch to the ''Advanced'' tab. Scroll down in the ''Properties (P)'' list on the left to find ''VLAN ID''.
4. Set the VLAN ID
In the ''Value (V)'' input field on the right, enter the VLAN ID that matches the development board (for example, 100). Click ''OK'' to save the settings. The network adapter will then reload, applying the VLAN tags.


