infrastructure-doc/configuration-files/phy0-ARN/iptables.sh
2022-04-24 11:50:51 +02:00

58 lines
2.1 KiB
Bash
Executable File

#!/bin/sh
alpha="192.168.122.84"
team="192.168.122.132"
bsdbuild="192.168.122.165"
baguette="192.168.122.181"
rd="192.168.122.211"
# association
ceius="192.168.122.30"
# not currently running
bsdservices="192.168.122.131"
#
# Rules
#
# alpha
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 80 -j DNAT --to-destination ${alpha}:80
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 443 -j DNAT --to-destination ${alpha}:443
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2203 -j DNAT --to-destination ${alpha}:22
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 9998 -j DNAT --to-destination ${alpha}:9998
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 9999 -j DNAT --to-destination ${alpha}:9999
# team
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2201 -j DNAT --to-destination ${team}:22
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2210 -j DNAT --to-destination ${team}:22
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2299 -j DNAT --to-destination ${team}:22
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 25 -j DNAT --to-destination ${team}:25
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 587 -j DNAT --to-destination ${team}:587
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 993 -j DNAT --to-destination ${team}:993
# rd
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2205 -j DNAT --to-destination ${rd}:22
# bsdbuild
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2265 -j DNAT --to-destination ${bsdbuild}:22
# CEIUS
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2230 -j DNAT --to-destination ${ceius}:22
# bsdservices
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2200 -j DNAT --to-destination ${bsdservices}:22
# baguette
iptables -t nat -A PREROUTING -p tcp -i eth1 --dport 2220 -j DNAT --to-destination ${baguette}:22
#
# HOW-TO `iptables`
#
# remove the second entry of the LIBVIRT_FWI chain # iptables -D LIBVIRT_FWI 2
# list nat rules: # iptables -L -t nat --line-numbers
# Accept to forward any packet from any local VM
iptables -A FORWARD -p tcp -i virbr0 -s 192.168.122.0/24