summaryrefslogtreecommitdiff
path: root/roles/ws/minet/templates/connections/elevateWire.j2
blob: e907c88d1d3dca1db4576f343f628b64892ddd8c (plain) (blame)
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
#!/bin/sh

SHORT_NAME="elevatewire"
DESC_NAME="elevate WIRE"
INTERFACE="{{ ws_minet_wired_interface_name }}"
MODULE_NAME="{{ ws_minet_wired_interface_module }}"

. /usr/local/lib/minet/minet_helpers.sh

case "$1" in
  start|"")
    echo "Connecting with $DESC_NAME"
    activate_interface $INTERFACE $MODULE_NAME
    for VLAN in 18 20 23 42 48 73; do
      ip link add link $INTERFACE name $INTERFACE.$VLAN type vlan id $VLAN
      ip addr add dev $INTERFACE.$VLAN 192.168.$VLAN.250/24
      ip link set up dev $INTERFACE.$VLAN
    done
    ip link add link $INTERFACE name $INTERFACE.511 type vlan id 511
    ip addr add dev $INTERFACE.511 10.12.241.138/28
    ip link set up dev $INTERFACE.511
    ip route add 10.0.0.0/8 via 10.12.241.142
    ip route add default via 192.168.18.254
    echo "search spreadspace.org" > /tmp/$SHORT_NAME.resolv
    echo "domain spreadspace.org" >> /tmp/$SHORT_NAME.resolv
    echo "nameserver 192.168.18.254" >> /tmp/$SHORT_NAME.resolv
    resolvconf -a $INTERFACE < /tmp/$SHORT_NAME.resolv
    rm /tmp/$SHORT_NAME.resolv
    ;;
  stop)
    echo "Disconnecting from $DESC_NAME"
    resolvconf -d $INTERFACE
    deactivate_interface $INTERFACE $MODULE_NAME
    ;;
  *)
    exit 1
    ;;
esac