From dfc0f2ba3b8dbe4ce99e014046df0fef0bbd6d30 Mon Sep 17 00:00:00 2001 From: kev Date: Sat, 29 Oct 2016 01:05:25 +0800 Subject: [PATCH] add hans-arm --- hans/README.md | 26 +++++++++++++++++++++----- hans/arm/Dockerfile | 22 ++++++++++++++++++++++ hans/arm/docker-compose.yml | 8 ++++++++ hans/systemd/hans | 2 +- 4 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 hans/arm/Dockerfile create mode 100644 hans/arm/docker-compose.yml diff --git a/hans/README.md b/hans/README.md index d3c4706..519c530 100644 --- a/hans/README.md +++ b/hans/README.md @@ -4,10 +4,17 @@ hans [Hans][1] makes it possible to tunnel IPv4 through ICMP echo packets, so you could call it a ping tunnel. +## How It Works + +``` +Client ---> G.F.W ---> Server ---> Internet + tun0 ping tun0 +``` + ## docker-compose.yml ```yaml -hans: +server: image: vimagick/hans environment: - NETWORK=10.1.2.0 @@ -15,13 +22,22 @@ hans: net: host privileged: yes restart: always + +client: + image: easypi/hans-arm + environment: + - SERVER=1.2.3.4 + - PASSWORD=password + net: host + privileged: yes + restart: always ``` ## Server Setup ```bash -# Start Server Program -$ docker-compose up -d +# Start Server Container +$ docker-compose up -d server # Enable Masquerade (Method A) $ iptables -t nat -A POSTROUTING -s 10.1.2.0/24 -o eth0 -j MASQUERADE @@ -33,8 +49,8 @@ $ firewall-cmd --add-masquerade ## Client Setup ```bash -# Start Client Program -$ hans -f -c 1.2.3.4 -p password +# Start Client Container +$ docker-compose up -d client # Access Server Directly $ ip route add 1.2.3.4 via 192.168.1.1 diff --git a/hans/arm/Dockerfile b/hans/arm/Dockerfile new file mode 100644 index 0000000..9761dff --- /dev/null +++ b/hans/arm/Dockerfile @@ -0,0 +1,22 @@ +# +# Dockerfile for hans-arm +# + +FROM easypi/alpine-arm +MAINTAINER EasyPi Software Foundation + +RUN set -xe \ + && apk add --no-cache build-base curl libstdc++ linux-headers tar \ + && mkdir hans \ + && cd hans \ + && curl -sSL https://github.com/friedrich/hans/archive/v0.4.4.tar.gz | tar xz --strip 1 \ + && make \ + && mv hans /usr/bin/hans \ + && cd .. \ + && rm -rf hans \ + && apk del build-base curl linux-headers tar + +ENV SERVER 1.2.3.4 +ENV PASSWORD password + +CMD hans -f -c $SERVER -p $PASSWORD diff --git a/hans/arm/docker-compose.yml b/hans/arm/docker-compose.yml new file mode 100644 index 0000000..10ad87c --- /dev/null +++ b/hans/arm/docker-compose.yml @@ -0,0 +1,8 @@ +hans: + image: easypi/hans-arm + environment: + - SERVER=1.2.3.4 + - PASSWORD=password + net: host + privileged: yes + restart: always diff --git a/hans/systemd/hans b/hans/systemd/hans index a2126a9..f1c3959 100644 --- a/hans/systemd/hans +++ b/hans/systemd/hans @@ -1,4 +1,4 @@ # /etc/default/hans -GATEWAY=192.168.31.1 +GATEWAY=192.168.1.1 SERVER=1.2.3.4 PASSWORD=password