diff --git a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select
index c3d003f..4c03a23 100755
--- a/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select
+++ b/src/packages/fff/fff-vpn-select/files/usr/sbin/vpn-select
@@ -1,7 +1,45 @@
 #!/bin/sh
 
+. /lib/functions/fff/wireless
+
 test -f /tmp/started || exit
 
+set_wifi() {
+wget -T15 "http://keyserver.freifunk-franken.de/${project}/wireless.php?mac=$mac" -O /tmp/wireless_${project}_output
+$NEWSETTINGS=$(cat /tmp/wireless_${project}_output)
+#check the settings the same as set if not set it new and reboot the Node if it the same do nothing
+#we get the settings in this format from keyxchangev2: ESSID_AP;ESSID_MESH;BSSID_MESH
+ESSID_AP_AKT=$(cat /etc/community.cfg  | grep ESSID_AP | cut -d "=" -f 2)
+ESSID_MESH_AKT=$(cat /etc/community.cfg  | grep ESSID_MESH | cut -d "=" -f 2)
+BSSID_MESH_AKT=$(cat /etc/community.cfg  | grep BSSID_MESH | cut -d "=" -f 2)
+CHECKSAME="$ESSID_AP_AKT;$ESSID_MESH_AKT;$BSSID_MESH_AKT" #we change this later to have the same format as the decentralized KeyXchange
+if [ "$CHECKSAME" == "$NEWSETTINGS" ]; then
+	echo "We have same settings and do nothing"
+else
+	#here we must write the config file new and reboot after
+	ESSID_AP_NEW=$(cat /tmp/wireless_${project}_output | cut -d ";" -f 0)
+	ESSID_MESH_NEW=$(cat /tmp/wireless_${project}_output | cut -d ";" -f 1)
+	BSSID_MESH_NEW=$(cat /tmp/wireless_${project}_output | cut -d ";" -f 2)
+	rm /etc/community.cfg
+	touch /etc/community.cfg
+	echo 'BATMAN_CHANNEL=1' >> /etc/community.cfg
+	echo 'BATMAN_CHANNEL_5GHZ=36' >> /etc/community.cfg
+	echo 'ESSID_AP=$ESSID_AP_NEW' >> /etc/community.cfg
+	echo 'ESSID_MESH=$ESSID_MESH_NEW' >> /etc/community.cfg
+	echo 'BSSID_MESH=$BSSID_MESH_NEW' >> /etc/community.cfg
+	echo 'VPN_PROJECT=fff' >> /etc/community.cfg
+	echo 'NTPD_IP=fe80::ff:feee:1%br-mesh' >> /etc/community.cfg
+	echo 'UPGRADE_PATH=http://[fe80::ff:feee:1%br-mesh]/dev/firmware/current' >> /etc/community.cfg
+	#copy my own Hood information to webroot that can download a Meshrouter
+	rm /www/public/hoodinfo.txt
+	echo "$NEWSETTINGS" < /www/public/hoodinfo.txt
+	#copy the 60-fff-wireless from rom to overlayfs to set the new settings after reboot
+	cp /rom/etc/uci-defaults/60-fff-wireless /etc/uci-defaults/60-fff-wireless
+	#and now reboot the Router to set the new settings
+	reboot
+fi
+}
+
 make_config() {
 # remove old config
 >/etc/config/tunneldigger
@@ -35,6 +73,8 @@ for file in $filecounts; do
         rm /etc/fastd/${project}/peers/$file
     fi
 done
+#now we load the wireless Information from the keyxchangev2:
+set_wifi
 }
 
 # main
@@ -43,9 +83,10 @@ test_ipv4_host2="8.8.8.8"        # Google DNS
 test_ipv6_host1="heise.de"       # heise Zeitschriftenverlag
 
 # Only do something when the router has internet connection
-if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
+if (ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
    ping -w5 -c3 "$test_ipv4_host2" &>/dev/null ||
-   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null; then
+   ping6 -w5 -c3 "$test_ipv6_host1" &>/dev/null) &&
+   [ $(cat /tmp/novpn) != "1" ]; then
 
     # set some vars
     . /etc/community.cfg
@@ -86,4 +127,47 @@ if ping -w5 -c3 "$test_ipv4_host1" &>/dev/null ||
         fi
 
     fi
+else
+	# now we check to have Batmangateways in range
+	if [ "$(batctl gwl | grep "no gateway")" ]; then
+		#now we haven't a gateway in Range, we search for a hidden AP to get Internet and reach the KeyXchangev2 
+		#set this to not open a vpn because we have in the next step Internet
+		echo "1" > /tmp/novpn
+		#first we delete all wifi settings
+		if ! wifiDelAll; then
+			echo "Can't delete current wifi setup"
+			exit 1
+		fi
+		#now we look for phy and add this
+		for phy in $(iw phy | awk '/^Wiphy/{ print $2 }'); do
+			if iw phy "$phy" info | grep -q -m1 "2... MHz"; then
+				echo "$phy is 2.4 GHz"
+				radio=$(wifiAddPhy "$phy" "$BATMAN_CHANNEL")
+				if [ -z "$radio" ]; then
+					echo "Can't create radio for $phy"
+					exit 1
+				fi
+			fi
+			if iw phy "$phy" info | grep -q -m1 "5... MHz"; then
+				echo "$phy is 5 GHz"
+				radio=$(wifiAddPhy "$phy" "$BATMAN_CHANNEL_5GHZ")
+				if [ -z "$radio" ]; then
+					echo "Can't create radio for $phy"
+					exit 1
+				fi
+			fi
+			#and here we add the station
+			if ! wifiAddSta "$radio" "config.franken.freifunk.net"; then
+				echo "Can't add Sta interface on $radio."
+				exit 1
+			fi
+			#here we must set a fix ip adress on the new wifi interface! come later!
+		done
+		#and here we can check to reach the keyxchangev2
+
+		set_wifi
+	else
+		echo "we have a gateway in range and do nothing"
+	fi
+
 fi
diff --git a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless
index 8c990ce..1d1d248 100644
--- a/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless
+++ b/src/packages/fff/fff-wireless/files/lib/functions/fff/wireless
@@ -117,4 +117,33 @@ wifiAddAP() {
 	echo "${iface}"
 }
 
+wifiAddSta() {
+	if [ $# -ne "2" ]
+	then
+		echo "Usage: wifiAddSta <radio> <essid>"
+		return 1
+	fi
+
+	local radio=$1
+	local essid=$2
+
+	local channel=$(uci get "wireless.${radio}.channel")
+	local iface="w2Sta"
+	if [ "$channel" -gt "14" ]; then
+		iface="w5Sta"
+	fi
+	uci batch <<-__EOF__
+		set wireless.${iface}='wifi-iface'
+		set wireless.${iface}.device='${radio}'
+		set wireless.${iface}.network='StaWiFi'
+		set wireless.${iface}.ifname='${iface}'
+		set wireless.${iface}.mode='sta'
+		set wireless.${iface}.ssid='${essid}'
+
+		commit wireless
+	__EOF__
+
+	echo "${iface}"
+}
+
 # vim: set noexpandtab:tabstop=4
