change formatting

input examples are now given as

```bash
input $ARG1
```

While outputs use md's '> ' sign as a quote.
This commit is contained in:
2023-06-17 21:28:20 +02:00
parent 1ba3010b81
commit ba8026e0c3
102 changed files with 2388 additions and 3211 deletions

View File

@@ -8,7 +8,9 @@ This is a basic Linux firewall program.
Look at your firewalls:
> iptables -L
```bash
iptables -L
```
We see the output of input, output and forwarding rules.
@@ -16,19 +18,27 @@ We see the output of input, output and forwarding rules.
I don't need any forwarding, so I'm going to drop all forwarding:
> iptables -P FORWARD DROP
```bash
iptables -P FORWARD DROP
```
# Input
Let's 'A'dd, or 'A'ppend a rule with -A. Let's drop all input from a nearby IP
> iptables -A INPUT -s 192.168.0.23 -j DROP
```bash
iptables -A INPUT -s 192.168.0.23 -j DROP
```
Or we can block all input from a particular port on the full Network.
> iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP
```bash
iptables -A INPUT -s 192.168.0.0/24 -p tcp --destination-port 25 -j DROP
```
> iptables -A INPUT --dport 80 -j ACCEPT
```bash
iptables -A INPUT --dport 80 -j ACCEPT
```
This allows http traffic to an Apache web server over port 80.
@@ -37,11 +47,15 @@ However, rules are accepted in order - so a packet cannot be rejected and then a
To delete rule 2 from the INPUT chain:
> iptables -D INPUT 3
```bash
iptables -D INPUT 3
```
Alternatively, you can 'I'nsert a rule at the start, rather than 'A'ppending it.
> iptables -I INPUT -s 192.168.0.13 DROP
```bash
iptables -I INPUT -s 192.168.0.13 DROP
```
# Catchalls
@@ -53,7 +67,9 @@ The -j flag accepts ACCEPT/REJECT/DROP. The last two are identical except that
Flush all existing rules with:
> iptables -F
```bash
iptables -F
```
# Examples