summaryrefslogtreecommitdiff
path: root/roles/ws/minet/templates/connections/ccc2019Wire.j2
blob: 553b7c4e48c00eafbebaf5c83196647b42ffc9d6 (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
#!/bin/sh

SHORT_NAME="ccc2019wire"
DESC_NAME="cccamp2019 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 41 126; 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.19 type vlan id 19
    ip link set up dev $INTERFACE.19
    dhclient $INTERFACE.19 -v -pf /var/run/dhclient.$SHORT_NAME.pid
    ;;
  stop)
    echo "Disconnecting from $DESC_NAME"
    dhclient -x -pf /var/run/dhclient.$SHORT_NAME.pid
    deactivate_interface $INTERFACE $MODULE_NAME
    ;;
  *)
    exit 1
    ;;
esac