diff options
-rw-r--r-- | docs/examples/tunnel-he-ipv6 | 11 | ||||
-rw-r--r-- | src/connections/tunnel | 41 |
2 files changed, 52 insertions, 0 deletions
diff --git a/docs/examples/tunnel-he-ipv6 b/docs/examples/tunnel-he-ipv6 new file mode 100644 index 0000000..21b4579 --- /dev/null +++ b/docs/examples/tunnel-he-ipv6 @@ -0,0 +1,11 @@ +CONNECTION='tunnel' +DESCRIPTION='A example ipv6 tunnel with Hurricane Electric' + +INTERFACE='he-ipv6' +MODE='sit' +REMOTE='216.66.80.26' +#LOCAL='172.16.0.1' + +IP6='static' +ADDR6='2001:470:1f08:d87::2/64' +ROUTES6=('::/0') diff --git a/src/connections/tunnel b/src/connections/tunnel new file mode 100644 index 0000000..613cc67 --- /dev/null +++ b/src/connections/tunnel @@ -0,0 +1,41 @@ +#! /bin/bash +. /usr/lib/network/network + +tunnel_up() { + load_profile "$1" + + if [ -e "/sys/class/net/$INTERFACE" ]; then + report_fail "Interface $INTERFACE already exists." + exit 1 + else + ip tunnel add "$INTERFACE" mode "$MODE" remote "$REMOTE" + fi + + if [[ -n "$LOCAL" ]]; then + ip tunnel change "$INTERFACE" local "$LOCAL" + fi + + bring_interface up "$INTERFACE" + + "$CONN_DIR/ethernet" up "$1" + return 0 +} + +tunnel_down() { + load_profile "$1" + + "$CONN_DIR/ethernet" down "$1" + bring_interface down "$INTERFACE" + ip tunnel del "$INTERFACE" + + return 0 +} + +tunnel_status() { + true +} + +tunnel_$1 "$2" +exit $? + +# vim: set ts=4 et sw=4: |