Tag Archives: unifi

Unifi USG Radius default vlan

on USG

/config/scripts/post-config.d/radius_default_vlan.sh

#!/bin/bash
# radius_default_vlan.sh
# This script goes in /config/scripts/post-config.d


if [[ -z "$1" ]] ; then
	echo "* * * * * root /config/scripts/post-config.d/radius_default_vlan.sh cron" > /etc/cron.d/radius_default_vlan
	exit 0
fi



if grep -q "DEFAULT Auth-Type" "/etc/freeradius/users" ; then
	exit 0
fi

cat >> /etc/freeradius/users <<EOF

DEFAULT Auth-Type := Accept
	Tunnel-Type             = 13,
	Tunnel-Medium-Type      = 6,
	Tunnel-Private-Group-Id = 1

EOF

service freeradius restart

install

chmod +x /config/scripts/post-config.d/radius_default_vlan.sh
/config/scripts/post-config.d/radius_default_vlan.sh

remove

rm /etc/cron.d/radius_default_vlan
rm /config/scripts/post-config.d/radius_default_vlan.sh