Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
freedombone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Context Sensitive Group
freedombone
Commits
1bcd6a21
Commit
1bcd6a21
authored
9 years ago
by
Bob Mottram
Browse files
Options
Downloads
Patches
Plain Diff
Mesh peer interfaces configuration
parent
8aae517e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/freedombone-client
+31
-7
31 additions, 7 deletions
src/freedombone-client
with
31 additions
and
7 deletions
src/freedombone-client
+
31
−
7
View file @
1bcd6a21
...
...
@@ -32,7 +32,8 @@ CURR_USER=$USER
VERSION
=
"1.01"
# mesh networking settings
BATMAN_IPV6
=
BRIDGE_BATMAN_IPV6
=
PEER_BATMAN_IPV6
=
# ssh (from https://stribika.github.io/2015/01/04/secure-secure-shell.html)
SSH_CIPHERS
=
"chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com,aes256-ctr,aes192-ctr,aes128-ctr"
...
...
@@ -83,7 +84,7 @@ function configure_ssh_client {
}
function
mesh_batman
{
if
[
!
$BATMAN_IPV6
]
;
then
if
[
!
$
BRIDGE_
BATMAN_IPV6
]
;
then
return
fi
sudo
apt-get
-y
install
iproute bridge-utils libnetfilter-conntrack3 batctl
...
...
@@ -95,6 +96,29 @@ function mesh_batman {
sudo echo
'batman_adv'
>>
/etc/modules
fi
# If no address has been given then create a ramdom one
if
[
!
$PEER_BATMAN_IPV6
]
;
then
hexarray
=(
1 2 3 4 5 6 7 8 9 0 a b c d e f
)
a
=
${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}
b
=
${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}
c
=
${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}
d
=
${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}${
hexarray
[
$RANDOM
%16]
}
PEER_BATMAN_IPV6
=
"
$IPV6_NETWORK
:
$a
:
$b
:
$c
:
$d
"
fi
sudo cp
/etc/network/interfaces ~/interfaces
if
!
grep
-q
"# Mesh Networking (B.A.T.M.A.N)"
~/interfaces
;
then
echo
''
>>
~/interfaces
echo
'# Mesh Networking (B.A.T.M.A.N)'
>>
~/interfaces
echo
'iface bat0 inet6 static'
>>
~/interfaces
echo
' pre-up modprobe ipv6'
>>
~/interfaces
echo
" address
$PEER_BATMAN_IPV6
"
>>
~/interfaces
echo
' netmask 64'
>>
~/interfaces
sudo mv
~/interfaces /etc/network/interfaces
else
sudo rm
~/interfaces
fi
echo
'#!/bin/bash'
>
/tmp/freedombone_mesh
echo
''
>
/tmp/freedombone_mesh
echo
'# stop network manager to make the mesh network work'
>>
/tmp/freedombone_mesh
...
...
@@ -109,7 +133,7 @@ function mesh_batman {
echo
''
>>
/tmp/freedombone_mesh
echo
'# add the interface to the ad-hoc network - or create it.'
>>
/tmp/freedombone_mesh
echo
-n
"iwconfig wlan0 mode ad-hoc essid mesh ap "
>>
/tmp/freedombone_mesh
echo
"
$BATMAN_IPV6
channel 2"
>>
/tmp/freedombone_mesh
echo
"
$
BRIDGE_
BATMAN_IPV6
channel 2"
>>
/tmp/freedombone_mesh
echo
''
>>
/tmp/freedombone_mesh
echo
-n
'# add wlan0 to the batman-adv virtual interface(so it can '
>>
/tmp/freedombone_mesh
echo
'communicate with other batman-adv nodes)'
>>
/tmp/freedombone_mesh
...
...
@@ -127,7 +151,7 @@ function mesh_batman {
function
show_help
{
echo
''
echo
'freedombone-client --
mesh
-ip [mesh bridge IPv6 address]'
echo
'freedombone-client --
bridge
-ip [mesh bridge IPv6 address]'
echo
''
exit
0
}
...
...
@@ -140,9 +164,9 @@ case $key in
-h
|
--help
)
show_help
;;
--
mesh
-ip
)
--
bridge
-ip
)
shift
BATMAN_IPV6
=
"
$1
"
BRIDGE_
BATMAN_IPV6
=
"
$1
"
;;
*
)
# unknown option
...
...
@@ -155,7 +179,7 @@ echo 'Configuring client'
configure_ssh_client
mesh_batman
echo
'Configuration complete'
if
[[
$BATMAN_IPV6
]]
;
then
if
[[
$
BRIDGE_
BATMAN_IPV6
]]
;
then
echo
''
echo
'Type "sudo mesh" to connect to the mesh network'
fi
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment