User Tools

Site Tools


network:freebsdvlan

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
network:freebsdvlan [2013/12/19 15:35]
tschulz
network:freebsdvlan [2016/10/26 13:10]
tschulz [On the Fly]
Line 1: Line 1:
 +
 +
 ====== Tagged Vlans on FreeBSD ====== ====== Tagged Vlans on FreeBSD ======
  
 +===== On the Fly =====
 +<file bash>
 +ifconfig vlan_device.vlan_id create
 +</​file>​
  
-The first thing to do is to list the VLANs that will be on the **lan0** adapter:+ 
 +===== Using rc.conf ===== 
 + 
 +The first thing to do is to list the VLANs that will be on the **em0** adapter:
 <file /​etc/​rc.conf>​ <file /​etc/​rc.conf>​
-vlans_lan0="101 102"+vlans_em0="101 102"
 </​file>​ </​file>​
  
 +Be be to bring the parent interfaces up before you configure the IPv4 on the vlans
 +<​file>​
 +ifconig_em0="​up"​
 +</​file>​
 This will cause FreeBSD to create new “virtual” network adapters called **lan0.101** and **lan0.102** – and these seem to function much like any other network card, you can use ifconfig on them. This will cause FreeBSD to create new “virtual” network adapters called **lan0.101** and **lan0.102** – and these seem to function much like any other network card, you can use ifconfig on them.
 Then, configure the actual addresses for the new virtual adapters: Then, configure the actual addresses for the new virtual adapters:
 <file /​etc/​rc.conf>​ <file /​etc/​rc.conf>​
-ifconfig_lan0_101="inet 10.1.1.1/​24"​ +ifconfig_em0_101="inet 10.1.1.1/​24"​ 
-ifconfig_lan0_102="inet 10.1.2.1/​24"​+ifconfig_em0_102="inet 10.1.2.1/​24"​
 </​file>​ </​file>​
  
 Now **reboot your system** or run **/​etc/​rc.d/​netif restart** - you should now see something like this in your ifconfig output: Now **reboot your system** or run **/​etc/​rc.d/​netif restart** - you should now see something like this in your ifconfig output:
 <​file>​ <​file>​
-lan0.101: flags=8843<​UP,​BROADCAST,​RUNNING,​SIMPLEX,​MULTICAST>​ metric 0 mtu 1500+em0.101: flags=8843<​UP,​BROADCAST,​RUNNING,​SIMPLEX,​MULTICAST>​ metric 0 mtu 1500
         ether 00:​1b:​b9:​8b:​ca:​33         ether 00:​1b:​b9:​8b:​ca:​33
         inet 10.1.1.1 netmask 0xffffff00 broadcast 10.1.1.255         inet 10.1.1.1 netmask 0xffffff00 broadcast 10.1.1.255
Line 24: Line 37:
         status: active         status: active
         vlan: 101 parent interface: lan0         vlan: 101 parent interface: lan0
-lan0.102: flags=8843<​UP,​BROADCAST,​RUNNING,​SIMPLEX,​MULTICAST>​ metric 0 mtu 1500+em0.102: flags=8843<​UP,​BROADCAST,​RUNNING,​SIMPLEX,​MULTICAST>​ metric 0 mtu 1500
         ether 00:​1b:​b9:​8b:​ca:​33         ether 00:​1b:​b9:​8b:​ca:​33
         inet 10.1.2.1 netmask 0xffffff00 broadcast 10.1.2.255         inet 10.1.2.1 netmask 0xffffff00 broadcast 10.1.2.255
network/freebsdvlan.txt · Last modified: 2016/10/26 13:10 by tschulz