Skip to content

Commit

Permalink
Merge pull request #345 from dennisreimann/fix-pi-ufw-ssh
Browse files Browse the repository at this point in the history
Allow ssh connections from docker network on RPI
  • Loading branch information
pavlenex authored Oct 11, 2019
2 parents ab45b17 + b70a600 commit 251be3f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions RPi3.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,15 @@ Install UFW:
sudo apt install ufw
```

This command allows SSH connections from your LAN only.<br/>
**⚠️ Replace `192.168.1.0` with your own subnet:**
This command allows SSH connections from internal networks only:
```bash
sudo ufw allow from 192.168.1.0/24 to any port 22
sudo ufw allow from 10.0.0.0/8 to any port 22 proto tcp
sudo ufw allow from 172.16.0.0/12 to any port 22 proto tcp
sudo ufw allow from 192.168.0.0/16 to any port 22 proto tcp
sudo ufw allow from 169.254.0.0/16 to any port 22 proto tcp
sudo ufw allow from fc00::/7 to any port 22 proto tcp
sudo ufw allow from fe80::/10 to any port 22 proto tcp
sudo ufw allow from ff00::/8 to any port 22 proto tcp
```

These ports need to be accessible from anywhere (The default subnet is 'any' unless you specify one):
Expand Down
11 changes: 8 additions & 3 deletions RPi4.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,11 +183,16 @@ ufw default deny incoming
ufw default allow outgoing
```

This command allows SSH connections from your LAN only.<br/>
**⚠️ Replace `192.168.1.0` with your own subnet:**
This command allows SSH connections from internal networks only:

```bash
sudo ufw allow from 192.168.1.0/24 to any port 22
ufw allow from 10.0.0.0/8 to any port 22 proto tcp
ufw allow from 172.16.0.0/12 to any port 22 proto tcp
ufw allow from 192.168.0.0/16 to any port 22 proto tcp
ufw allow from 169.254.0.0/16 to any port 22 proto tcp
ufw allow from fc00::/7 to any port 22 proto tcp
ufw allow from fe80::/10 to any port 22 proto tcp
ufw allow from ff00::/8 to any port 22 proto tcp
```

These ports need to be accessible from anywhere (The default subnet is 'any' unless you specify one):
Expand Down

0 comments on commit 251be3f

Please sign in to comment.