bsd.local.sh 1.1 KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. int=$1
  3. ip=$2
  4. vlan=$3
  5. vlanif="vlan$vlan"
  6. ngctl mkpeer vlan: eiface $vlanif ether
  7. ngctl name vlan:$vlanif $vlanif
  8. ngctl msg vlan: addfilter { vlan=$vlan hook="$vlanif" }
  9. ifconfig `ifconfig | grep ngeth | awk '{print $1}' | cut -f 1 -d :` name $vlanif
  10. ifconfig $vlanif ether `ifconfig $int | grep ether | awk '{print $2}'` up
  11. ifconfig bridge0 addm $vlanif
  12. ifconfig bridge0 private $vlanif
  13. ifconfig bridge0 -discover $vlanif
  14. ifconfig bridge0 sticky $vlanif
  15. echo "ngctl mkpeer vlan: eiface $vlanif ether" >> /etc/rc.d/start.sh
  16. echo "ngctl name vlan:$vlanif $vlanif " >> /etc/rc.d/start.sh
  17. echo "ngctl msg vlan: addfilter { vlan=$vlan hook=\"$vlanif\" } " >> /etc/rc.d/start.sh
  18. echo "ifconfig `ifconfig | grep ngeth | awk '{print $1}' | cut -f 1 -d :` name $vlanif " >> /etc/rc.d/start.sh
  19. echo "ifconfig $vlanif ether `ifconfig $int | grep ether | awk '{print $2}'` up " >> /etc/rc.d/start.sh
  20. echo "ifconfig bridge0 addm $vlanif " >> /etc/rc.d/start.sh
  21. echo "ifconfig bridge0 private $vlanif " >> /etc/rc.d/start.sh
  22. echo "ifconfig bridge0 -discover $vlanif " >> /etc/rc.d/start.sh
  23. echo "ifconfig bridge0 sticky $vlanif " >> /etc/rc.d/start.sh