This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| firewall:firewall [2022/08/26 19:17] – jc | firewall:firewall [2023/04/23 19:40] (current) – jc | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| 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 | ||
| </ | </ | ||