| Line 7: |
Line 7: |
| | ==Save to file== | | ==Save to file== |
| | iptables-save > output_iptables_conf_file | | iptables-save > output_iptables_conf_file |
| | + | |
| | + | == Persistent == |
| | + | <syntaxhighlight lang="bash"> |
| | + | sudo apt install iptables-persistent |
| | + | sudo iptables-save | sudo tee /etc/iptables/rules.v4 |
| | + | </syntaxhighlight> |
| | | | |
| | ==Collection of basic Linux Firewall iptables rules== | | ==Collection of basic Linux Firewall iptables rules== |
| Line 12: |
Line 18: |
| | ===Redirect connections to service=== | | ===Redirect connections to service=== |
| | <syntaxhighlight lang="bash"> | | <syntaxhighlight lang="bash"> |
| | + | #!/bin/bash |
| | + | # SERVER |
| | sysctl net.ipv4.ip_forward=1 | | sysctl net.ipv4.ip_forward=1 |
| | service networking restart | | service networking restart |
| | | | |
| | # iptables -t nat -A PREROUTING -p tcp --dport <puerto receptor> -j DNAT --to-destination <ip final>:<puerto de ip final> | | # iptables -t nat -A PREROUTING -p tcp --dport <puerto receptor> -j DNAT --to-destination <ip final>:<puerto de ip final> |
| | + | |
| | + | # Binance ETH Pool ethash.poolbinance.com |
| | iptables -t nat -A PREROUTING -p tcp --dport 1081 -j DNAT --to-destination 18.193.226.201:1800 | | iptables -t nat -A PREROUTING -p tcp --dport 1081 -j DNAT --to-destination 18.193.226.201:1800 |
| | + | |
| | + | # MineXMR Pool pool.minexmr.com |
| | + | iptables -t nat -A PREROUTING -p tcp --dport 1082 -j DNAT --to-destination 51.68.21.186:4444 |
| | + | iptables -t nat -A PREROUTING -p udp --dport 1082 -j DNAT --to-destination 51.68.21.186:4444 |
| | + | |
| | + | # Masquerade real ip |
| | iptables -t nat -A POSTROUTING -j MASQUERADE | | iptables -t nat -A POSTROUTING -j MASQUERADE |
| | | | |