• user warning: Got error 28 from storage engine query: SELECT t.*,v.weight AS v_weight_unused FROM pcp_term_node r INNER JOIN pcp_term_data t ON r.tid = t.tid INNER JOIN pcp_vocabulary v ON t.vid = v.vid WHERE r.vid = 155 ORDER BY v.weight, t.weight, t.name in /var/www/petercarrero.com/modules/taxonomy/taxonomy.module on line 640.
  • user warning: Got error 28 from storage engine query: SELECT DISTINCT b.* FROM pcp_blocks b LEFT JOIN pcp_blocks_roles r ON b.module = r.module AND b.delta = r.delta WHERE b.theme = 'absynthe' AND b.status = 1 AND (r.rid IN (1) OR r.rid IS NULL) ORDER BY b.region, b.weight, b.module in /var/www/petercarrero.com/modules/block/block.module on line 460.
Oct 01

Add VLAN tagging to a ProxMoxVE install

Fri, 10/01/2010 - 18:09 — peter
  • perform a normal proxmoxve setup from cd.
  • verify that adapter eth0 is being used in vmbr0 by typing "brctl show" on the command line
  • verify that adapter eth0 is the one with network traffic by typing "tcpdump -nn -i eth0" in the command line
  • if eth0 is not the right adapter (or the one without traffic), change the /etc/udev/rules.d/70-persistent-net.rules file, assigning eth0 to the proper interface
  • to find out the proper eth, use "ip link set up dev ethX" where X is a valid eth number and then do a "tcpdump -nn -i ethX" to see if there is traffic
  • after the proper eth is setup, setup vlan by adding the following to the /etc/network/interfaces file:

auto vmbr0<br>iface vmbr0 inet static<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; address 172.22.51.114<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; netmask 255.255.255.0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; network 172.22.51.0<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; broadcast 172.22.51.255<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bridge_ports eth0.51<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bridge_stp off<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; bridge_fd 0<br><br>

  • make sure to use the proper 4th octet on the interface ip address.
  • add the following lines to the end of the /etc/sysctl.conf file:

# Configure VLAN interfaces<br>net.ipv4.conf.vmbr0.proxy_arp = 1<br><br>net.ipv4.conf.all.arp_filter = 1

  • run sysctl -p to apply those settings.
  • create a file called /etc/network/if-up.d/set_vlan_route and put this in there:

#!/bin/bash<br>#<br># Script to configure a new routing table for the vlan51 interface.<br># It is assumed that the following command has already been done:<br>#<br># echo "200 vlan" &gt;&gt; /etc/iproute2/rt_tables<br>#<br><br>IP="/sbin/ip"<br>RT="/etc/iproute2/rt_tables"<br><br>/bin/egrep -q '200.+vlan' $RT<br>if [ $? -eq 1 ]; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; echo "200 vlan" &gt;&gt; $RT<br>fi<br><br># Clear all routes on table vlan<br>$IP route flush table vlan<br><br>$IP route add 172.22.51.0/24 dev vmbr0 proto kernel scope link src 172.22.51.99 table vlan<br><br># Set up default route for table vlan<br>$IP route add default via 172.22.51.1 dev vmbr0 table vlan<br><br>$IP rule show | /bin/egrep -q '^1000:'<br>if [ $? -eq 1 ]; then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # If packet is coming from the 172.22.51.x subnet, then use table vlan to route it<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $IP rule add from 172.22.51.0/24 lookup vlan prio 1000<br>fi<br><br># Flush the routing cache<br>$IP route flush cache

  • create a file called /etc/vz/conf/vps.mount and put this in it:

#!/bin/bash<br>#<br># Global mount script<br>#<br><br>IP=/sbin/ip<br><br># If one of the following files does not exist, then we gotta stop<br>[ -f /etc/vz/vz.conf ] || exit 1<br>[ -f $VE_CONFFILE ] || exit 1<br><br># Read in system config and VE config file<br>. /etc/vz/vz.conf<br>. $VE_CONFFILE<br><br># Set up vlan routes for VE<br>$IP route add $IP_ADDRESS dev venet0 scope link<br>$IP route add $IP_ADDRESS dev venet0 scope link table vlan<br><br>exit 0

  • create a file called /etc/vz/conf/vps.umount and put this in there:

#!/bin/bash<br>#<br># Global umount script<br>#<br><br>IP=/sbin/ip<br><br># If one of the following files does not exist, then we gotta stop<br>[ -f /etc/vz/vz.conf ] || exit 1<br>[ -f $VE_CONFFILE ] || exit 1<br><br># Read in system config and VE config file<br>. /etc/vz/vz.conf<br>. $VE_CONFFILE<br><br># Set up vlan routes for VE<br>$IP route del $IP_ADDRESS dev venet0 scope link table vlan<br>$IP route del $IP_ADDRESS dev venet0 scope link<br><br>exit 0

  • edit the /etc/vz/vz.conf file and add the following line:

VE_ROUTE_SRC_DEV="vmbr0"<strong></strong>

  • join the ve to the cluster by typing "pveca -a -h 172.22.51.99" from the command line. This assumes that the master is at 172.22.51.99.
  • if you get a message saying that that node already exists, then log into the master and type "pveca -l" and look at the ID number of the node with the same IP address you are trying to add. 
  • if this is indeed a defunct node, then on the cluster master issue a "pveca -d X" where X is the ID number you found above. this will remove any entries for that node on the master.
  • repeat the pveca -a -h <masterIP> command and you should have joined the cluster.
  • create a file called "/etc/apt/apt.conf.d/01proxy" and put the following line in it:

Acquire::http { Proxy "http://172.22.51.20:3128"; };

  • perform an "apt-get update" and "apt-get dist-upgrade".
  • those are lot of changes and most likely you will get a new kernel with those commands, so reboot for good measure.