All Projects → tozd → docker-external-ip

tozd / docker-external-ip

Licence: other
Configure external IP for Docker containers. Read-only mirror of https://gitlab.com/tozd/docker/external-ip

Programming Languages

Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to docker-external-ip

xt NAT
Full Cone NAT module for Linux iptables
Stars: ✭ 65 (+182.61%)
Mutual labels:  iptables
Linux-System-Management-Scripts-Tricks
Linux Security & Linux Hardening & Linux Management & Linux Configuration
Stars: ✭ 70 (+204.35%)
Mutual labels:  iptables
ipset-netgear-r7000-dd-wrt
Packages and kernel modules for ipset support for the Netgear R7000 running DD-WRT firmware
Stars: ✭ 45 (+95.65%)
Mutual labels:  iptables
ipify.sh
Unofficial client library for ipify: a simple IP address API
Stars: ✭ 30 (+30.43%)
Mutual labels:  external-ip
docker-nfqueue-scapy
Docker container for intercepting packets with scapy from a netfilter queue (nfqueue)
Stars: ✭ 78 (+239.13%)
Mutual labels:  iptables
DrawBridge
Layer 4 Single Packet Authentication Linux kernel module utilizing Netfilter hooks and kernel supported Berkeley Packet Filters (BPF)
Stars: ✭ 81 (+252.17%)
Mutual labels:  iptables
iptables-uwu
iptables target that uwu's outgoing packets
Stars: ✭ 86 (+273.91%)
Mutual labels:  iptables
uppersafe-osfw
UPPERSAFE Open Source Firewall
Stars: ✭ 21 (-8.7%)
Mutual labels:  iptables
nDPI
Open Source Deep Packet Inspection Software Toolkit
Stars: ✭ 92 (+300%)
Mutual labels:  iptables
webfilter-ng
Transparent HTTP/HTTPS/TLS web filter
Stars: ✭ 29 (+26.09%)
Mutual labels:  iptables
ddos-mitigation
Tips to mitigate and secure your large-scale server against DDoS attacks.
Stars: ✭ 58 (+152.17%)
Mutual labels:  iptables
hev-socks5-tproxy
A simple, lightweight socks5 transparent proxy for Linux. (IPv4/IPv6/TCP/UDP over TCP)
Stars: ✭ 209 (+808.7%)
Mutual labels:  iptables
ipt xor
iptables xor module
Stars: ✭ 15 (-34.78%)
Mutual labels:  iptables
go-ipset
🔥 Go bindings for the IPtables ipset http://ipset.netfilter.org userspace utility
Stars: ✭ 110 (+378.26%)
Mutual labels:  iptables
awesome-sysadmin-tools
Collection of links and resources for sysadmins and Drupal lovers
Stars: ✭ 17 (-26.09%)
Mutual labels:  iptables
UnboundBL
🛑 DNSBL (adblock) on OPNsense with UnboundBL & Unbound DNS
Stars: ✭ 63 (+173.91%)
Mutual labels:  iptables
droplan
Manage iptable rules for the private interface on DigitalOcean droplets
Stars: ✭ 69 (+200%)
Mutual labels:  iptables
netgwm
NetGWM (Network Gateway Manager)
Stars: ✭ 37 (+60.87%)
Mutual labels:  iptables
DROP-ISP-TCP-Hijacking
过滤运营商的劫持包
Stars: ✭ 77 (+234.78%)
Mutual labels:  iptables
awall
[MIRROR] Alpine firewall configuration tool
Stars: ✭ 37 (+60.87%)
Mutual labels:  iptables

tozd/external-ip

https://gitlab.com/tozd/docker/external-ip

Available as:

Description

Run:

$ docker run --detach \
 --net=host --cap-add=NET_ADMIN --cap-add=NET_RAW \
 --volume /var/run/docker.sock:/var/run/docker.sock \
 --volume /run/xtables.lock:/run/xtables.lock \
 tozd/external-ip:ubuntu-bionic

After that, if any other Docker container has an environment variable EXTERNAL_IP set, with an IP address to use for containers external IP, iptables will be configured to route container's traffic from that external IP. The external IP must be assigned on the host.

A chain named EXTERNAL_IP is created in the nat table into which all the rules are added. And one more empty chain is created after this one for any additional custom rules you might want to add, named AFTER_EXTERNAL_IP.

Please make sure /run/xtables.lock exists on the host before starting the container. This file ensures iptables locking is consistent between the host and the container, preventing race conditions that can cause containers to fail to start. If this file does not exist, Docker will incorrectly create it as a directory, which may cause issues both on the host and with the container.

docker-compose example

version: '3'

services:
  nat_manager:
    image: tozd/external-ip:ubuntu-bionic
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - /run/xtables.lock:/run/xtables.lock
    network_mode: host
    cap_add:
      - NET_ADMIN
      - NET_RAW

  a:
    image: byrnedo/alpine-curl
    command: "-s http://ifconfig.me"
    environment:
      EXTERNAL_IP: XX.XX.XX.XX

  b:
    image: byrnedo/alpine-curl
    command: "-s http://ifconfig.me"
    environment:
      EXTERNAL_IP: YY.YY.YY.YY

Set XX.XX.XX.XX and YY.YY.YY.YY to your external IP address.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].