iptables -F
iptables -P CHAIN ACTION
CHAIN: INPUT, FORWARD, OUTPUT ACTION: ACCEPT, DROP
iptables -A CHAIN -s SourceIP -i Interface0 -o Interface1 -d DestinationIP \ --sport Sourceports --dport DestinationPorts -p Protocol -m conntrack --ctstate ConnectionState -j ACTION
CHAIN: INPUT, OUTPUT oder FORWARD Interface0: Name des lokalen Interfaces (lo, eth0, enp0s3,…) Interface1: Name des lokalen Interfaces (lo, eth0, enp0s3,…) SourceIP: Quell-IP-Adresse, wenn fehlt: Alle DestinationIP: Ziel-IP-Adresse, wenn fehlt: Alle Sourceports: Quell-Ports, wenn fehlt: Alle Destinationports: Ziel-Ports, wenn fehlt: Alle Protocol: tcp, udp, … 1) -m conntrack: optional: Verbindungsstatus, ctstate erforderlich Connectionstate: NEW,ESTABLISHED,RELATED 2)
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE