Configuring VLAN in your freebsd box

Lately , I was given task to create a progam that I had to deal in dot1q protocol (by the way the program is based on sending packet over the wire and have to deal in multi-session support). I was doing socket programming and worst I had to edit the connect() function of kernel to be able to change my source IP address in connect() function. Damn it would take me a alot of time to edit the connect() function but what I did is to find other way to patch the output. And creating vlans in my freebsd is the patch that I took, but actually its not the real solution in my problem, it was just a patch.

Here’s the procedure to have a vlan in your freebsd.

first add this line to your /boot/loader.conf. :
if_vlan_load=”YES”

This will enable your vlan support in your freebsd or you can do :
kldload if_vlan

But this will just load temporary vlan support, when you reboot
you have to load it again.