This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| firewall:firewall [2022/08/16 10:58] – [iptables] jc | firewall:firewall [2023/04/23 19:40] (current) – jc | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Firewall ====== | + | < |
| - | ===== iptables | + | # Firewall |
| + | |||
| + | ## iptables | ||
| Accept SSH connections destined to 10.0.0.0/ | Accept SSH connections destined to 10.0.0.0/ | ||
| - | < | + | ``` bash |
| + | iptables -I INPUT -s 10.0.0.0/24 -p tcp --dport 22 -j ACCEPT | ||
| + | ``` | ||
| Deny all SSH connections. | Deny all SSH connections. | ||
| - | < | + | ``` bash |
| + | iptables -A INPUT -p tcp --dport 22 -j DROP | ||
| + | ``` | ||
| Rewrite the source address (SNAT) of packets egressing eth0 to 192.168.1.1. | Rewrite the source address (SNAT) of packets egressing eth0 to 192.168.1.1. | ||
| - | < | + | ``` bash |
| + | iptables -t nat -A POSTROUTING -o eth0 -j SNAT --to 192.168.1.1 | ||
| + | ``` | ||
| Rewrite the destination address (DNAT) 192.168.1.1 of a packet ingressing eth0 to the destination 192.168.2.2. | Rewrite the destination address (DNAT) 192.168.1.1 of a packet ingressing eth0 to the destination 192.168.2.2. | ||
| - | < | + | ``` bash |
| + | iptables -t nat -A PREROUTING -i eth0 -d 192.168.1.1 -j DNAT --to-destination 192.168.2.2 | ||
| + | ``` | ||
| Masquerade (NAT) all packets egressing interface wlan0. | Masquerade (NAT) all packets egressing interface wlan0. | ||
| - | < | + | ``` bash |
| + | iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE | ||
| + | ``` | ||
| Save iptables rules. | Save iptables rules. | ||
| - | < | + | ``` bash |
| - | + | iptables-save -f </ | |
| + | ``` | ||
| + | ## ebtables | ||
| + | ## firewalld | ||
| + | ## nftables | ||
| + | </ | ||