Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
802.1Q Trunking, OpenRC, Subinterfaces.
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
nathanlkoch
Apprentice
Apprentice


Joined: 31 Jan 2021
Posts: 163
Location: Earth / Sol

PostPosted: Fri Feb 12, 2021 7:28 am    Post subject: 802.1Q Trunking, OpenRC, Subinterfaces. Reply with quote

Hello,
I have my Cisco gear setup to do trunking. Previously I was using 10Vlans and 10Sub interfaces with systemd-networkd on a RHEL desktop.
My Desktop had no IP address, ipv6 or ipv4. With 10 sub interfaces that would all tag vlan traffic. My physical computer couldn't route to the internet.
But all of my Vlans, or sub interfaces could via virtual machines. eth0.10, eth.20, eth.30, and so on.

How can I do the same with OpenRC?

Previously in a systemd setup i would do something like this

Code:
network-scripts/ifcfg-enp6s0.30
DEVICE=enp6s0.30
ONBOOT=yes
#IPADDR=192.168.30.1
#PREFIX=24
#NETWORK=192.168.30.0
VLAN=yes

TYPE=Vlan
PHYSDEV=enp6s0
VLAN_ID=30
REORDER_HDR=yes
GVRP=no
MVRP=no
HWADDR=
PROXY_METHOD=none
BROWSER_ONLY=no
IPV6INIT=no
NAME="Vlan enp6s0.30"
UUID=dca0b63a-a056-9746-793f-390862daf4a5
ZONE=FedoraWorkstation
IPV6INIT=”no”
IPV6_AUTOCONF=”no”

network-scripts/ifcfg-enp6s0.20
DEVICE=enp6s0.20
BOOTPROTO=none
ONBOOT=yes
#IPADDR=192.168.20.1
#PREFIX=24
#NETWORK=192.168.20.0
VLAN=yes

IPV6INIT=”no”
IPV6_AUTOCONF=”no”

network-scripts/ifconfig-enp6s0.40
DEVICE=enp6s0.40
BOOTPROTO=none
ONBOOT=yes
#IPADDR=192.168.40.1
#PREFIX=24
#NETWORK=192.168.40.0
VLAN=yes

IPV6INIT=”no”
IPV6_AUTOCONF=”no”


Configured this way. All Sub-interfaces act as a switch and only route traffic for that vlan. Cisco switch port setup for 802.1q trunking encapsulation.

Some promising progress.

Code:

# You can also configure the VLAN - see for ip man page for more details
# To change the vlan interface name. If not set, the standard "iface.vlanid"
# will be used. This is the replacement for the old 'vconfig set_name_type'
# functionality. If you previously relied on the DEV_PLUS_VID or
# DEV_PLUS_VID_NO_PAD options to have different VLANs with same ID value, on
# different interfaces, please note that you need to use both the interface and
# vlan number in the numbering. This applies for all of the options: name,
# txqueuelen, mac, broadcast, mtu, ingress, egress, flags
#vlan1_name="vlan1"
#eth0_vlan2_name="eth0.2"
#eth1_vlan2_name="eth1.2"

# Set the vlan flags
#vlan1_flags="reorder_hdr off gvrp on loose_binding on"
#eth0_vlan1_flags="reorder_hdr off gvrp on loose_binding on"


# NOTE: Vlans can be configured with a . in their interface names
# When configuring vlans with this name type, you need to replace . with a _
#config_eth0.1="dhcp" - does not work
#config_eth0_1="dhcp" - does work

# NOTE: Vlans are controlled by their physical interface and not per vlan
# This means you do not need to create init scripts in /etc/init.d for each
# vlan, you must need to create one for the physical interface.
# If you wish to control the configuration of each vlan through a separate
# script then you need to do this.
#vlan_start_eth0="no"

# If you do the above then you may want to depend on eth0 like so
# rc_net_vlan1_need="net.eth0"
# NOTE: depend functions only work in /etc/conf.d/net
# and not in profile configs such as /etc/conf.d/net.foo

# Also, you might want to make eth0 not provide net in this case so that
# dependent services will start when the vlan is active instead of the
# physical interface.
# rc_net_eth0_provide="!net"


That's the stuff.
Back to top
View user's profile Send private message
nathanlkoch
Apprentice
Apprentice


Joined: 31 Jan 2021
Posts: 163
Location: Earth / Sol

PostPosted: Sat Feb 13, 2021 4:52 am    Post subject: Reply with quote

Code:

config_enp6s0="dhcp"
mtu_enp6s0="9168"


##### VLan 10

vlan10_name="vlan10"
enp6s0_vlan10_name="enp6s0.10"

# Set the vlan flags
#vlan10_flags="reorder_hdr off gvrp on loose_binding on"
#enp6s0_vlan10_flags="reorder_hdr off gvrp on loose_binding on"
# NOTE: Vlans can be configured with a . in their interface names
# When configuring vlans with this name type, you need to replace . with a _
#config_enp6s0.10="null" - does not work
#config_eth0_1="dhcp" - does work
# NOTE: Vlans are controlled by their physical interface and not per vlan
# This means you do not need to create init scripts in /etc/init.d for each
# vlan, you must need to create one for the physical interface.
# If you wish to control the configuration of each vlan through a separate
# script then you need to do this.
vlan_start_enp6s0="yes"
# If you do the above then you may want to depend on eth0 like so
# rc_net_vlan1_need="net.eth0"
# NOTE: depend functions only work in /etc/conf.d/net
# and not in profile configs such as /etc/conf.d/net.foo
# Also, you might want to make eth0 not provide net in this case so that
# dependent services will start when the vlan is active instead of the
# physical interface.


Still no luck. Have recycled service a few times now but sub interfaces not showing up.
Back to top
View user's profile Send private message
pa4wdh
l33t
l33t


Joined: 16 Dec 2005
Posts: 910

PostPosted: Sat Feb 13, 2021 9:06 am    Post subject: Reply with quote

You'll first have to setup your physical interface, or rather have to tell netifrc you want it up but not configured with any address, otherwise it'll do dhcp.
You physical interface seems to be enp6s0, so in /etc/conf.d/net that becomes:
Code:

config_enp6s0="null"

Now, you need to tell it you want your vlans on it, again in /etc/conf.d/net:
Code:

vlans_enp6s0="10 20 30 40"

I hope i guessed the right vlan numbers from your configuration, feel free to adjust to your need :)
Now, for every vlan interface you can specify it's IP configuration just as you would do with a regular interface.
For example for vlan 20, again in /etc/conf.d/net:
Code:

config_enp6s0_20="192.168.20.1 netmask 255.255.255.0"

Now make sure you have made a symlink in /etc/init.d named net.enp6s0 toward net.lo:
Code:

cd /etc/init.d
ln -s net.lo net.enp6s0

And start your interface
Code:

/etc/init.d/net.enp6s0 start

_________________
The gentoo way of bringing peace to the world:
USE="-war" emerge --newuse @world

My shared code repository: https://code.pa4wdh.nl.eu.org
Music, Free as in Freedom: https://www.jamendo.com
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum