![]() ![]() |
vlubnt |
Subversion Repositories: |
Compare with Previous - Blame - Download
#!/bin/sh# vlubnt 0.0.1# Vojtech Pavlikif ! HOST=`grep -- "resolv.host.1.name=.*-VLAN" /tmp/system.cfg`; then exit 0; fiif ! BRIDGE=`ip addr show br0 | grep inet`; then exit 0; fiif ! DEFAULT=`ip r | grep default`; then exit 0; fiIP=`echo $BRIDGE | sed -e "s/^.*inet //" -e "s/ scope.*$//"`if test -z "${IP}"; then exit 0; fiVLAN=`echo $HOST | sed -e "s/^.*-VLAN//"`if test -z "${VLAN}"; then exit 0; fiDR=`echo $DEFAULT | sed -e "s/dev.*$//"`if test -z "${DR}"; then exit 0; fi# Move IP address to eth0_realip addr del ${IP} dev br0brctl delif br0 eth0_realip addr add ${IP} dev eth0_real# Add new default routeip r add ${DR}# Move AP to VLANvconfig add eth0_real ${VLAN}ip link set eth0_real.${VLAN} upbrctl addif br0 eth0_real.${VLAN}