0

Hints about working with VLAN? I have to write a client-server program, where the client will send a packet through eth0 and the server will receive the packet on VLAN, and to send it to a concerned VLAN client should parse on which command line VLAN will receive it?

Ink
  • 1
  • 2

1 Answers1

2

Usually there is nothing to do in the application to work with a VLAN. The VLAN is realized using a virtual network interface with its own IP address. From the perspective of the application this is not different from a real network interface with own IP address. The OS will take care about routing and encapsulation of packets and there is nothing to do from the application itself.

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
  • do I need to use an ethernet header, to send it successfully, and on the server do I need to bind the Interface. – Ink Sep 28 '20 at 04:22
  • @lazy_day: Again, there is nothing special you have to do in the application since it is all handled by the OS already. – Steffen Ullrich Sep 28 '20 at 04:26
  • if I have to pass vlanTag number, which sockaddr I should use for L2, does vlan packets comes under broadcast domain.... – Ink Oct 10 '20 at 06:36
  • @Ink: Again and again - your don't have to pass the vlan tag. It will be added automatically based on the source and destination IP and which interface/IP is selected for routing by the OS. – Steffen Ullrich Oct 10 '20 at 07:30