1
0
mirror of https://github.com/vimagick/dockerfiles.git synced 2024-12-12 11:14:57 +02:00
dockerfiles/hans/README.md

71 lines
1.3 KiB
Markdown
Raw Normal View History

2016-10-28 16:24:03 +02:00
hans
====
[Hans][1] makes it possible to tunnel IPv4 through ICMP echo packets, so you
could call it a ping tunnel.
2016-10-28 19:05:25 +02:00
## How It Works
```
Client ---> G.F.W ---> Server ---> Internet
tun0 ping tun0
```
2016-10-28 16:24:03 +02:00
## docker-compose.yml
```yaml
2016-10-28 19:05:25 +02:00
server:
2016-10-28 16:24:03 +02:00
image: vimagick/hans
environment:
- NETWORK=10.1.2.0
- PASSWORD=password
net: host
privileged: yes
restart: always
2016-10-28 19:05:25 +02:00
client:
image: easypi/hans-arm
environment:
- SERVER=1.2.3.4
- PASSWORD=password
net: host
privileged: yes
restart: always
2016-10-28 16:24:03 +02:00
```
## Server Setup
```bash
2016-10-28 19:05:25 +02:00
# Start Server Container
$ docker-compose up -d server
2016-10-28 17:01:36 +02:00
# Enable Masquerade (Method A)
$ iptables -t nat -A POSTROUTING -s 10.1.2.0/24 -o eth0 -j MASQUERADE
# Enable Masquerade (Method B)
$ firewall-cmd --add-masquerade
2016-10-28 16:24:03 +02:00
```
## Client Setup
```bash
2016-10-28 19:05:25 +02:00
# Start Client Container
$ docker-compose up -d client
2016-10-28 16:24:03 +02:00
# Access Server Directly
$ ip route add 1.2.3.4 via 192.168.1.1
# Change Default Route (Method A)
$ ip route change default via 10.1.2.1
# Change Default Route (Method B)
$ ip route add 0.0.0.0/1 dev tun0
$ ip route add 128.0.0.0/1 dev tun0
2016-11-01 10:32:49 +02:00
# Enable IP Forwarding
$ sysctl -w net.ipv4.ip_forward=1
$ iptables -t nat -A POSTROUTING -s 192.168.1.0/24 -o tun0 -j MASQUERADE
2016-10-28 16:24:03 +02:00
```
[1]: http://code.gerade.org/hans/