Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Mirror physical interface to virtual interface

Linux Kernel, Network, and Services configuration.
Post Reply
Message
Author
Talkabout
Posts: 5
Joined: 2019-06-23 09:40

Mirror physical interface to virtual interface

#1 Post by Talkabout »

Hi guys,

I have a networking issue and hope that somebody is able to help.

Following situation:

Existing interfaces:

eth0 => physical interface
eth0.30 => virtual interface (vlan 30)
eth0.50 => virtual interface (vlan 50)
eth0.100 => virtual interface (vlan 100)

I want to run a tool that connects to network interfaces on the "raw" level but does not handle vlan tagging correctly (KEA DHCP server). That means if I bind it to all interfaces, tagged traffic will arrive at interface eth0.x AND eth0. By removing "eth0" from the list of bound interfaces everything works as expected, but I need it also to listen to eth0.

My idea now is to create a virtual interface that basically mirrors traffic of eth0 and can be used by the tool. Because on kernel level the tagged traffic will be correctly forwarded to the tagged interface and thus only reaches the new interface if the traffic is untagged (in theory).

After several unsuccessful tries with bridging I am now at a point where I need some help.

Following questions:

1. is my idea about the virtual interface a possible solution or is there something better?
2. how do I configure my network interfaces correctly to work the way I need it to (with systemd-networkd)?
3. what other things do I need to consider?

If possible I would like to avoid changes in my network infrastructure!

Thanks for everybody trying to help!

Bye

Talkabout
Posts: 5
Joined: 2019-06-23 09:40

Re: Mirror physical interface to virtual interface

#2 Post by Talkabout »

Hi all,

for anybody who might have a similar issue, I was able to solve mine in the following way:

- Create a macvlan device via systemd-networkd:

eth1.netdev

Code: Select all

[NetDev]
Name=eth1
Kind=macvlan
MACAddress=xx:xx:xx:xx:xx:xx (generate a unique mac address and put it here)

[MACVLAN]
Mode=bridge
eth1.network

Code: Select all

[Match]
Name=eth1

[Network]
Address=192.168.xx.xx/24 (put a valid ip from your subnet for all 3 values)
Gateway=192.168.xx.x
DNS=192.168.xx.xx
IPForward=yes
- on the physical device definition you need to define that it belongs to the created mac vlan:

Code: Select all

[Match]
Name=eth0 (your physical device)

[Network]
... (keep previous values)
MACVLAN=eth1
...
When now systemd-networkd gets restarted, eth1 device is considered a separate network interface with a valid hardware address and ip. Now creating a "raw" bind on that device does not interfere with the vlan any more.

Hope that helps!

Bye

Post Reply