Skip to content

astralblue/ngvlan

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 

Repository files navigation

ngvlan

ngvlan is FreeBSD rc.d script that sets up/tears down VLAN interfaces using Netgraph. Unlike the traditional vlan(4), ngvlan allows forwarding untagged VLAN (often the management VLAN) traffic to a bridge(4) interface.

Quickstart

The following /etc/rc.conf snippet creates genet0.256 through genet0.259

# Configure tagged VLANs 256-259 on genet0.
# This creates VLAN interfaces genet0.256 through genet0.259.
ngvlan_enable="YES"
ngvlan_interfaces="genet0"
ngvlan_genet0_vlans="256 257 258 259"

Per-VLAN bridges for jails and/or bhyves

The following /etc/rc.conf snippet configures per-VLAN bridges for untagged management VLAN 1 and tagged VLANs 256-259. VLAN traffic is diverted to and merged from per-VLAN bridges, via:

  • VLAN interfaces created by ngvlan (for tagged VLANs);
  • the parent interface (for the untagged management VLAN).
# Configure tagged VLANs 256-259 on genet0.
# This creates VLAN interfaces genet0.256 through genet0.259.
ngvlan_enable="YES"
ngvlan_interfaces="genet0"
ngvlan_genet0_vlans="256 257 258 259"

# Add the parent interface (for the untagged management VLAN 1) and
# the VLAN interfaces (for tagged VLANs 256-259) to their per-VLAN bridges.
cloned_interfaces="bridge1 bridge256 bridge257 bridge258 bridge259"
autobridge_interfaces="bridge1 bridge256 bridge257 bridge258 bridge259"
autobridge_bridge1="genet0"
autobridge_bridge256="genet0.256"
autobridge_bridge257="genet0.257"
autobridge_bridge258="genet0.258"
autobridge_bridge259="genet0.259"

# Configure bridge1 with management IP addresses and routing.
# auto_linklocal ensures bridge1 gets a LL address (required for NDP to work).
ifconfig_bridge1="inet 192.0.2.25/24"
ifconfig_bridge1_ipv6="inet6 2001:db8:1234:5678::19/64 auto_linklocal"
defaultrouter="192.0.2.1"
ipv6_defaultrouter="2001:db8:1234:5678::1"

# Ensure the other interfaces are up even though they do not get IP addresses.
ifconfig_genet0="up"        # parent
ifconfig_genet0_256="up"    # tagged ngvlan interfaces
ifconfig_genet0_257="up"
ifconfig_genet0_258="up"
ifconfig_genet0_259="up"
ifconfig_bridge256="up"     # per-VLAN bridges
ifconfig_bridge257="up"
ifconfig_bridge258="up"
ifconfig_bridge259="up"

About

FreeBSD rc script for Netgraph VLAN interfaces

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages