[VLAN] vlans in socket progrmaming

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Stefan,

On Mon, May 30, 2005 at 10:37:56AM +0200, Stefan Linecker wrote:
> i'm searching for a code-snippet/faq/tutorial showing basic vlan
> things in socket programming, especially how to set and get the
> vlan-id in network packets.
> 
> anybody out who can help? any hints welcome.

VLAN tags are assigned by the kernel depending on which interface
packets are sent out on. So the normal rules for routing applies even
with VLAN interfaces.

The vconfig administrative tool adds VLAN interfaces "onto" an
existing interface, either physical or virtual. (ie. eth0 and br0
both work as the "base" interface) The new interfaces are named like
eth0.4 by default, where 4 is the VLAN number as specified when
running vconfig.

Then, a network address is assigned to eth0.4, and when an
application bind():s to this address or if the default route is
through the eth0.4 interface, a VLAN tag of 4 is added to outgoing
packets by the kernel.

If you really want to construct VLAN packets in user-space you'll
need to use a raw socket and do all of the protocols on your own.


//Peter

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]     [Video 4 Linux]

  Powered by Linux