How Can Layer 2 be encapsulated (in order to add some information) and sent over the internet. On the receiver side the added information will be used, and then the packet will be decapsulated to get the original L2.

  • 1
    You might want to review your tags. L2 requires bridging and what you're probably up to is tunneling. Before you're trying to bridge Ethernet(?) into the 'net you should take a look at IP forwarding, ie. simple routing or VPN.
    – Zac67
    Jul 31, 2017 at 11:47
  • 2
    There are several ways to do this, but we need to understand what you are trying to do in order to give you any useful answer. Please provide us with a better description of what you're trying to do. As @Zac67 points out, maybe L2 is not the right solution.
    – Ron Trunk
    Jul 31, 2017 at 11:53
  • Hi, I just try to add extra data to packet my computer application send, so I want to connect a "box" to my computer Ethernet port which will add my extra data. On my other receiving side computer, the same "box" connect to the modem on one side and the computer Ethernet port on the other side and it should read the information that was added, and then transfer to the computer the original pocket without the added data. Note the computer can be anywhere on the global internet network Jul 31, 2017 at 13:18
  • 1
    If this is just send-some-information-from-one-node-to-another - why not just use a TCP socket? Or a UDP datagram? Anything you handcraft is bulky to begin with.
    – Zac67
    Jul 31, 2017 at 17:09
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you can provide and accept your own answer.
    – Ron Maupin
    Feb 19, 2018 at 20:22

5 Answers 5


If you want to tunnel layer 2, the first one that comes to mind is the Layer 2 Tunnelling Protocol per RFC 2661 which isn't trivial as it's built on top of PPP. However lots of equipment already supports it.

A simple one which comes to mind is EtherIP, which tunnels ethernet frames in IP packets in a very straightforward way, per RFC 3378. I don't think it's widely used, but I believe Cisco wireless LAN controllers use it to implement mobility groups.

EDIT: You say you're adding some information at magic box, transporting it, unwrapping it and delivering it. Although of course tunnels are a possible way, if the added information is small, you could use standard IP options, perhaps using an experimental option code per RFC 4227.

As noted in other answers: watch for MTU, and are you sure you're in the right forum?


It sounds like you need to create your own protocol. A layer-2 protocol, e.g. ethernet, has a frame that is fixed and not expandable to add information. Trying to change the frame will cause the FCS to be incorrect, which will cause the entire frame and payload to be dropped as damaged. If the frame is already at its maximum size, then it would be dropped as a giant if you make it any bigger. Also, the layer-2 frame headers are stripped from the layer-3 packet by a router, so the frames never cross the Internet.

Layer-3 packets also have limitations. You can wrap a packet inside another packet (tunnel), but then you may exceed the MTU. The layer-3 packet header will be in the format of the layer-3 protocol, and changing it by adding information will have consequences.

You can easily create a tunnel (this is done all the time for different reasons), but packets are routed based on the packet header, which include a length for the payload. If you change the packet payload to add information, then you must change the packet header, and in the case of IPv4, that will require recomputing the CRC in the Header Checksum field.

There are many things to take into account for what you are trying to do, and this would be a custom protocol, which would be off-topic here. Also, it would involve programming, which is off-topic here.

  • Well, you could pretty easily put the payload in question into a UDP datagram and that's that. I'm pretty sure the approach is completely over the top.
    – Zac67
    Jul 31, 2017 at 17:13
  • Yes, that would be a tunnel with the added information needing a different, custom protocol to add and remove it, and it can have a problem with the MTU.
    – Ron Maupin
    Jul 31, 2017 at 17:15

Encapsulation is done via software such as the Internet Protocol suite of software.


Take a look at VXLAN protocol. It encapsulates L2 information in a UDP packet. I'm not saying use VXLAN -- your custom protocol will be different, but its structure would be similar to what you seem to have in mind.

Since your question is rather vague, that's about as detailed an answer you will get here.


I think you are referring to what is under wide discussion and continuous devlopment. Read about EVPN solution

  1. https://www.juniper.net/documentation/en_US/junos/topics/concept/evpn-vxlan-data-plane-encapsulation.html.
  2. https://www.cisco.com/c/en/us/products/collateral/switches/nexus-9000-series-switches/white-paper-c11-729383.html

As Ron stated, MP-BGP EVPN for VXLAN is what would best fit for your requirement at this moment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.