-
Notifications
You must be signed in to change notification settings - Fork 0
/
node_init
executable file
·70 lines (54 loc) · 1.64 KB
/
node_init
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
##
# run as root
##
#stop network manager to make the mesh network work
echo "Stopping Network Manager"
if [ -f /etc/debian_version ]; then
sudo service network-manager stop
elif [[ -f /etc/redhat-release ]] || [[ -f /etc/arch-release ]]; then
sudo pkill NetworkManager
fi
# load the module up
echo "Loading batman-adv kernel module"
modprobe batman-adv
##
# waiting for interface to be released properly
# by network manager. sometimes resource busy error
# message pops up.
##
sleep 2
##
# note: the name of your ethernet & wireless interface
# may vary. please do ifconfig, find the proper name
# for your interfaces and change here before running
# the script.
##
ip link set up dev eth0
ip link set mtu 1532 dev wlan0
##
# configure the wlan interface to operate with mtus of 1532(batman requires it)
# and turn enc off to ensure it works
##
# 1532 mtu is already set above in line 28
# enc off can be moved below while changing mode to ad-hoc
#ifconfig wlan0 down
#ifconfig wlan0 mtu 1532
#iwconfig wlan0 enc off
# add the interface to the ad-hoc network - or create it.
echo "switching to ad-hoc mode - PYMESH"
iwconfig wlan0 mode ad-hoc channel 6 essid PYMESH ap 02:12:34:56:78:9A enc off
#echo wlan0 > /proc/net/batman-adv/interfaces
# add wlan0 to the batman-adv virtual interface
# (so it can communicate with other batman-adv nodes)
echo "adding wireless interface to batman"
batctl if add wlan0
echo "bringing up wireless ad-hoc interface"
ifconfig wlan0 up
#echo wlan0 > /proc/net/batman-adv/interfaces
echo "bringing up bat0 interface"
ifconfig bat0 192.168.1.4 up
# look for neighbour nodes
#batctl -v
#batctl o
echo "DONE."