Linux: Trunking Interface Configuration in Gentoo

Even the configuration is perfectly documented in /usr/share/doc/openrc*/net.example*, it may be helpful to provide a working example of a trunk interface configuration…

The following example assumes a single interface named wan and two 802.1Q tagged VLANs connected to it. For some unspecified reasons, the example assumes VLAN 10 as an IPv4 connectivity only, and VLAN 20 as an IPv6 connectivity only. A static configuration of IPv4 and IPv6 addresses including default routing, DNS, and NTP will be provided as follows.


Open the /etc/conf.d/net network configuration file:

# The main interface needs to be up but no IP address will assigned.
# Unless defined otherwise, native (untagged traffic) VLAN can be specified here.

# Define VLANs
vlans_wan="10 20"

# VLAN tag 10 = IPv4 connectivity
routes_wan4="default via DEFAULT-GW-IPv4-ADDRESS"
dns_servers_wan4="IPv4-DNS-SERVER1 IPv4-DNS-SERVER2"
ntp_servers_wan4="IPv4-NTP-SERVER1 IPv4-NTP-SERVER2"

# VLAN tag 20 = IPv6 connectivity
routes_wan6="default via DEFAULT-GW-IPv6-ADDRESS"
dns_servers_wan6="IPv6-DNS-SERVER1 IPv6-DNS-SERVER2"
ntp_servers_wan6="IPv6-NTP-SERVER1 IPv6-NTP-SERVER2"

Of course, IPv4 and IPv6 can coexist on a single interface, thus there is no need for such design. However, there may be reasons (e.g., automatic IPv4 preference) requiring such deployment.

This entry was posted in Linux, Server and tagged , , , , , . Bookmark the permalink.