blob: 61a729257ee441dbb0dfd0840d8202f8433285aa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
#!/bin/sh
echo "Soll dieser Router als Gateway arbeiten? (j/n) "
read router
echo
if [[ $router = "j" ]]
then
#Act a a Router
#set ipv4 Adress
echo "Bitte geben sie die IP-Adresse des Routers an (siehe http://www.freifunk-jena.de/NodeDB)"
read ipv4_adress
#IP Zerlegen
oct1=`echo $ipv4_adress | awk -F . '{print $1}'`
oct2=`echo $ipv4_adress | awk -F . '{print $2}'`
oct3=`echo $ipv4_adress | awk -F . '{print $3}'`
oct4=`echo $ipv4_adress | awk -F . '{print $4}'`
uci set network.mesh.ipaddr=$ipv4_adress
uci set network.mesh.proto=static
uci set network.mesh.netmask=255.255.0.0
uci set dhcp.mesh=dhcp
uci set dhcp.mesh.start=2
uci set dhcp.mesh.limit=254
uci set dhcp.mesh.leasetime=12h
uci set dhcp.mesh.interface=mesh
uci set dhcp.mesh.start_ip=10.17.$oct3.2
uci set dhcp.mesh.end_ip=10.17.$oct3.254
uci commit dhcp
# Batman Server Mode
uci set batman-adv.bat0.gw_mode=server
uci commit batman-adv
else
# Act as a node only
uci del dhcp.mesh
uci commit dhcp
uci del network.mesh.ipaddr
uci del network.mesh.proto
uci del network.mesh.netmask
uci commit network
echo "Der Router wird als normaler Node konfiguriert"
echo
# Batman Clientr Mode
uci set batman-adv.bat0.gw_mode=client
uci commit batman-adv
fi
uci commit
/etc/init.d/batman-adv restart
#TODO: Generate Subnet
#TODO: DHCP Configuration
#HINT: Port freifunk-wizzard-leipzig in from lua (http://luci.subsignal.org/trac/browser/luci/branches/luci-0.10/applications/luci-ffwizard-leipzig/luasrc/model/cbi/ffwizard.lua)
|