2

How to create an ethernet frame in python with a specification of VLAN?

I have the IP and TCP header ready. I need to attach the ethernet header to it.

1

1 Answer 1

2

You can use Scapy:

from scapy import inet
newpkt = inet.Ether()/inet.Dot1Q(vlan=1)/inet.IP()

There are many tutorials... You can start with this: http://www.secdev.org/projects/scapy/doc/usage.html

If you wanna play with sockets, you can find a good example at https://github.com/osrg/openvswitch/blob/master/utilities/ovs-vlan-test.in

Sign up to request clarification or add additional context in comments.

1 Comment

well i am aware of scapy. But I do not want to use scapy becasue it is slow :/

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.