- Add radvd

- minor fixes
This commit is contained in:
Roman Katrincak 2015-12-13 13:33:33 +01:00
parent 163f43c1a1
commit 84f4373ea4
7 changed files with 80 additions and 38 deletions

View File

@ -1,5 +1,7 @@
#!/bin/sh
exit 0
release=$(/bin/uname -r)
nodeid=$( /bin/echo {{ sn_mesh_MAC }} | /bin/sed s/://g)
meshh_if=$(/bin/cat /sys/class/net/troisdorf*/address | /bin/grep -v ^00:00:00)

View File

@ -2,7 +2,7 @@
INTERFACE="$3"
#MAC="$8"
#BLACKLISTFILE=/opt/freifunk/blockliste.txt
batctl=/usr/local/sbin/batctl
#if [ -f /opt/freifunk/blockliste.txt ]
@ -22,7 +22,7 @@ INTERFACE="$3"
#ip link set address {{ sn_mesh_MAC }} dev $INTERFACE
ifconfig $INTERFACE hw ether {{ sn_mesh_MAC }}
ip link set dev $INTERFACE up mtu 1312
/bin/ip link set dev $INTERFACE up mtu 1312
/sbin/sysctl net.ipv4.conf.$INTERFACE.rp_filter=0
/usr/sbin/batctl if add $INTERFACE
$batctl if add $INTERFACE

View File

@ -159,7 +159,7 @@ LoadPlugin users
#LoadPlugin thermal
#LoadPlugin tokyotyrant
#LoadPlugin unixsock
#LoadPlugin uptime
LoadPlugin uptime
#LoadPlugin uuid
#LoadPlugin varnish

View File

@ -14,6 +14,10 @@ communitynetworkv6="fda0:747e:ab29:7405:255::"
octet3rd="255"
# CIDR muss /16 sein
localserver=$(/bin/hostname)
# files
batadv=/usr/local/sbin/batadv-vis
alfred=/usr/local/sbin/alfred
batctl=/usr/local/sbin/batctl
for i in $server; do
@ -26,7 +30,7 @@ for i in $server; do
/sbin/ip link set dev $j mtu $mtu
/sbin/ip link set address $communitymacaddress:${i#$communityname}${j#$communityname} dev $j
/sbin/ip link set $j up
/usr/sbin/batctl if add $j
$batctl if add $j
fi
fi
@ -40,6 +44,11 @@ done
/sbin/ip link set up dev bat0
/sbin/ip addr add $communitynetwork.$octet3rd.${localserver#$communityname}/16 broadcast $communitynetwork.255.255 dev bat0
/sbin/ip -6 addr add fda0:747e:ab29:7405:255::${localserver#$communityname}/64 dev bat0
/usr/local/sbin/alfred -i bat0 > /dev/null 2>&1 &
/usr/sbin/batadv-vis -i bat0 -s > /dev/null 2>&1 &
/usr/bin/killall alfred
/usr/bin/killall batadv-vis
/bin/sleep 5
$alfred -i bat0 > /dev/null 2>&1 &
/bin/sleep 15
$batadv -i bat0 -s > /dev/null 2>&1 &
/usr/sbin/service bind9 restart

12
files/radvd.conf.j2 Normal file
View File

@ -0,0 +1,12 @@
interface bat0 {
AdvSendAdvert on;
IgnoreIfMissing on;
MaxRtrAdvInterval 200;
RDNSS {{ sn_mesh_IPv6 }} {};
prefix fda0:747e:ab29:7405::/64 {
AdvOnLink on;
AdvAutonomous on;
AdvRouterAddr on;
};
};

View File

@ -1,5 +1,7 @@
#!/bin/sh
curl -X POST --data-urlencode 'payload={"text": "{{ sn_hostname }} is rebooted", "channel": "#technik", "username": "{{ sn_hostname }}", "icon_emoji": ":floppy_disk:"}' https://hooks.slack.com/services/{{ slack_token }}
# Stop tunneldigger until bat0 is up
#/usr/sbin/service tunneldigger stop
@ -15,7 +17,7 @@
# Activate IP forwarding
/sbin/sysctl -w net.ipv6.conf.all.forwarding=1
/sbin/sysctl -w net.ipv4.ip_forward=1
/sbin/sysctl kernel.panic=10
/sbin/sysctl kernel.panic=1
# Routing table 200 for traffic above port 1023
#/bin/grep 200 /etc/iproute2/rt_tables || /bin/echo 200 iffy >> /etc/iproute2/rt_tables
@ -37,6 +39,9 @@
#/bin/ip route replace default via {{ sn_iffy_traffic }} table iffy
# Start tunneldigger
#/usr/sbin/service tunneldigger start
/usr/sbin/service tunneldigger restart
# radvd restart
/usr/sbin/service radvd restart
exit 0

View File

@ -29,12 +29,15 @@
- ebtables
- python-virtualenv
- iptables-persistent
- batctl
# - batctl
- iftop
- screen
- bridge-utils
- tcpdump
- bind9
- radvd
- curl
- htop
modules_required:
- batman-adv
- nf_conntrack_netlink
@ -112,13 +115,15 @@
timeout=300
when: hosts.changed
when: sethostname.changed
- apt: update_cache=yes
- name: Install common required packages
apt: state=installed pkg={{ item }}
with_items: common_required_packages
register: apt_updates
- name: Install Linux headers
shell: "apt-get install linux-headers-$(uname -r) -y"
when: apt_updates.changed
register: aptupdates
# - name: Install Linux headers
# shell: >
# apt-get install linux-headers-$(uname -r) -y
# when: aptupdates.changed
- name: Add modules
lineinfile: dest=/etc/modules line={{ item }}
with_items: modules_required
@ -127,11 +132,41 @@
modprobe: name={{ item }}
with_items: modules_required
when: modules_req.changed
- name: Install Linux headers
shell: >
apt-get install linux-headers-$(uname -r) -y
when: aptupdates.changed
- name: Get batman-adv
git: repo=https://git.open-mesh.org/batman-adv.git
dest=/tmp/batman-adv
when: aptupdates.changed
register: getbatman
- name: Install batman-adv
shell: cd /tmp/batman-adv && git checkout master && make && make install
when: getbatman.changed
- name: Get batctl
git: repo=http://git.open-mesh.org/batctl.git
dest=/tmp/batctl
when: aptupdates.changed
register: getbatctl
- name: Install batctl
shell: cd /tmp/batctl && git checkout master && make && make install
when: getbatctl.changed
- name: Get alfred
git: repo=http://git.open-mesh.org/alfred.git
dest=/tmp/alfred
when: aptupdates.changed
register: getalfred
- name: Install alfred
shell: cd /tmp/alfred && git checkout master && make && make install
when: getalfred.changed
- name: Get Tunneldigger
git: repo=https://github.com/wlanslovenija/tunneldigger.git
dest=/srv/tunneldigger
register: tunneldigger
when: apt_updates.changed
when: aptupdates.changed
- name: Configure tunneldigger
command: "{{item}}"
with_items:
@ -163,29 +198,6 @@
- name: Copy logrotate config
copy: src=./files/{{ item }} dest=/etc/ owner=root group=root mode=0500
with_items: logrotate_config
- shell: test -f /usr/local/sbin/alfred
register: alfred_file
failed_when: alfred_file.rc > 1
changed_when: alfred_file.rc == 1
- name: Get alfred
git: repo=http://git.open-mesh.org/alfred.git
dest=/tmp/alfred
register: git_alfred
when: alfred_file.rc == 1
- name: make alfred
shell: cd /tmp/alfred && git checkout v2015.1 && make && make install
register: git_alfred
when: alfred_file.rc == 1
# - name: Download alfred
# get_url:
# url="https://firmware.freifunk-wuppertal.net/deb/alfred_2015.0_amd64.deb"
# dest="/tmp/alfred_2015.0_amd64.deb"
# when: alfred_check_deb.rc == 1
# - name: Install alfred
# apt: deb="/tmp/alfred_2015.0_amd64.deb"
# sudo: False
# when: alfred_check_deb.rc == 1
# - name: copy openvpn files
# copy: src=./files/{{ item }} dest=/etc/openvpn owner=root group=root mode=0400
# with_items: openvpn_files
@ -229,6 +241,8 @@
lineinfile: dest=/etc/bind/named.conf line='include "/etc/bind/named.conf.fftdf";' state=present
- name: Copy option template
template: src=./files/named.conf.options.j2 dest=/etc/bind/named.conf.options owner=root group=bind mode=644
- name: Copy radvd config template
template: src=./files/radvd.conf.j2 dest=/etc/radvd.conf owner=radvd group=root mode=0444
- name: Reboot the server finally
shell: sleep 2 && shutdown -r now "Ansible updates triggered"
async: 1