LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-21-2016, 08:25 PM   #1
elcapitan
LQ Newbie
 
Registered: Jun 2016
Posts: 1

Rep: Reputation: Disabled
Adding/Removing VLAN Tag to an Incoming/Outgoing Packet


I want to be able to do following to an ethernet interface on a Ubuntu machine:

1. Add a 802.1Q VLAN tag to an incoming packet. The incoming packet can have an existing tag, so the new tag will be inserted in front of it. For example, I want every incoming packet from eth0 to have a new VLAN tag to be added.

Incoming Packet on eth0:
+---------------------------------------------------------------+
|DMAC|SMAC|Existing Tag|EthType| Payload |
+---------------------------------------------------------------+

gets modified to

+---------------------------------------------------------------+
|DMAC|SMAC|New Tag|Existing Tag|EthType| Payload |
+---------------------------------------------------------------+


2. Remove Outer Tag for outgoing packet. If the packet egressing the interface has a 802.1Q tag, it should be removed. There can be more than one tags on the interface, but only the outer tag should be removed.


Outgoing packet on eth0:

+---------------------------------------------------------------+
|DMAC|SMAC|Outer Tag|Inner Tag|EthType| Payload |
+---------------------------------------------------------------+

gets modified to when it gets out on the wire

+---------------------------------------------------------------+
|DMAC|SMAC|Inner Tag|EthType| Payload |
+---------------------------------------------------------------+

Are there any linux commands which will allow me to achieve this.

Thanks
 
Old 06-26-2016, 02:27 AM   #2
jnihil
Member
 
Registered: Dec 2012
Location: inside the matrix
Distribution: Debian, Xubuntu, Gentoo, Antergos
Posts: 90

Rep: Reputation: 27
802.1ad (Q-in-Q) can be done with some fiddling around. Here's a good write-up and use-case:
http://events.linuxfoundation.org/si...makita_0_0.pdf
 
Old 09-02-2021, 05:42 PM   #3
verde94
LQ Newbie
 
Registered: Sep 2021
Posts: 1

Rep: Reputation: Disabled
Removing vlan

Hi, sorry for reheating old topic. I'm facing similar issue. I can't find a solution. I have linux envirement, on one of it's interfaces frames with vlan tags or with no vlan tags can arrive. I want to remove vlan tag (any) from incoming frames if it belongs to certain ethertype (CFM) or certain MAC adress (more than one mostly macvlan but not only). How can I achive this "conditional" vlan tags tear off?
Thank you
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sending ethernet packet with VLAN tag in C socket Praju26 Linux - Networking 9 07-01-2015 06:34 PM
[SOLVED] Why the eth0 send out the packet with tag vlan id 0 wesley_q Linux - Networking 3 03-02-2015 07:44 AM
vlan tag packet is stripped in eth1 not in eth2 interface? sargurus Linux - Networking 0 04-03-2014 10:44 AM
disabling vlan tag stripping on NetXtreme BCM5721 NIC Shaggy1 Linux - Networking 1 11-02-2010 07:34 AM
Route non-vlan packet to a vlan interface mic.sed Linux - Networking 2 04-23-2010 02:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 10:15 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration