Configuring VLAN in your freebsd box

Posted in FREEBSD by edeguzman on June 8, 2008

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.

Now in your ifconfig do this:
ifconfig device.vlan_number ip_address/mask
ex:
ifconfig sk0.2 create 192.168.2.1/24

This will create vlan in your ifconfig. Of course the connected network must be in the same vlan ID.

Now if you want to remove the vlan id in your freebsd. You can do this:
ifconfig sk0.2 destroy

This will remove your vlan configuration.

And that would be all.

One Response

Subscribe to comments with RSS.

  1. With Mesothelioma said, on April 10, 2009 at 4:13 pm

    just happened in….

    Really love msn, interesting read. Take care….


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: