Access private network from the internet, support port forwarding from private network to outside via cloud.
sudo apt-get update && sudo apt-get install -y curl
curl -sSL https://raw.githubusercontent.com/vzakharchenko/docker-pptp-port-forwarding/main/ubuntu.install -o ubuntu.install
chmod +x ubuntu.install
./ubuntu.install
- Docker image
- Management routing and portforwarding using json file
- Connect to LAN from the internet
- Port forwarding through VPN (PPTP)
- Connect multiple networks
- Automatic installation(Ubuntu)
- Manual Installation steps (Ubuntu)
{
"users": {
"USER_NAME": {
"password": "PASSWORD",
"ip": "192.168.122.XX",
"forwarding": [{
"sourceIp": "APPLICATION_IP",
"sourcePort": "APPLICATION_PORT",
"destinationIP": REMOTE_IP
"destinationPort": REMOTE_PORT
}],
"routing": [
{
"route": "ROUTING_TABLE"
}
]
}
}
}
Where
- USER_NAME username or email
- PASSWORD user password
- 192.168.122.XX uniq ip from range 192.168.122.10-192.168.122.254
- APPLICATION_IP service IP behind NAT (port forwarding)
- APPLICATION_PORT service PORT behind NAT (port forwarding)
- REMOTE_IP remote IP
- REMOTE_PORT port accessible from the internet (port forwarding)
- ROUTING_TABLE ip with subnet for example 192.168.8.0/24
user1 - router with subnet 192.168.88.0/24 behind NAT user2 - user who has access to subnet 192.168.88.0/24 from the Internet
{
"users": {
"user1": {
"password": "password1",
"ip": "192.168.122.10",
"routing": [
{
"route": "192.168.88.0/24"
}
]
},
"user2": {
"password": "password2",
"ip": "192.168.122.11"
}
}
}
user - router with subnet 192.168.88.0/24 behind NAT. Subnet contains service http://192.168.8.254:80 which is available at from http://195.138.164.211:9000
{
"users": {
"user": {
"password": "password",
"ip": "192.168.122.10",
"forwarding": [{
"sourceIp": "192.168.88.1",
"sourcePort": "80",
"destinationPort": 9000
}],
}
}
}
user1 - router with subnet 192.168.88.0/24 behind NAT. Subnet contains service http://192.168.88.254:80 which is available at from http://195.138.164.211:9000 user2 - router with subnet 192.168.89.0/24 behind NAT. user3 - user who has access to subnets 192.168.88.0/24 and 192.168.89.0/24 from the Internet
{
"users": {
"user1": {
"password": "password1",
"ip": "192.168.122.10",
"forwarding": [
{
"sourceIp": "192.168.88.254",
"sourcePort": "80",
"destinationPort": 9000
}
],
"routing": [
{
"route": "192.168.88.0/24"
}
]
},
"user2": {
"password": "password2",
"ip": "192.168.122.11",
"routing": [
{
"route": "192.168.89.0/24"
}
]
},
"user3": {
"password": "password3",
"ip": "192.168.122.12"
}
}
}
- Viewing logs in docker container:
docker logs pptp-port-forwarding -f
- print routing table
docker exec pptp-port-forwarding bash -c "ip route"
- print iptable rules
docker exec pptp-port-forwarding bash -c "iptables -S"
sudo apt-get update && sudo apt-get install -y curl
curl -sSL https://raw.githubusercontent.com/vzakharchenko/docker-pptp-port-forwarding/main/ubuntu.install -o ubuntu.install
chmod +x ubuntu.install
./ubuntu.install
- install all dependencies
sudo apt-get update && sudo apt-get install -y iptables git iptables-persistent node
- install docker
sudo apt-get remove docker docker.io containerd runc
sudo curl -sSL https://get.docker.com | bash
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker
- Configure host machine
echo "nf_nat_pptp" >> /etc/modules
echo "ip_gre" >> /etc/modules
iptables -I FORWARD -p gre -j ACCEPT
sudo iptables-save > /etc/iptables/rules.v4
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.netfilter.nf_conntrack_helper=1
sudo echo "net.ipv4.ip_forward=1">/etc/sysctl.conf
sudo echo "net.netfilter.nf_conntrack_helper=1">/etc/sysctl.conf
-
start docker image
export CONFIG_PATH=/opt/config.json
curl -sSL https://raw.githubusercontent.com/vzakharchenko/docker-pptp-port-forwarding/main/pptp-js/generateDockerCommands.js -o generateDockerCommands.js
`node generateDockerCommands.js`
- reboot machine