Skip to content

Commit fc31381

Browse files
author
Pavel Sklenar
committed
Updated guide to forwarding traffic
1 parent b2fe4d7 commit fc31381

File tree

1 file changed

+10
-0
lines changed
  • content/posts/extend-local-network-to-cloud-with-nebula

1 file changed

+10
-0
lines changed

content/posts/extend-local-network-to-cloud-with-nebula/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ sudo iptables -L -v -n | grep "Chain FORWARD"
4545

4646
If the previous command shows `policy ACCEPT`, you only need to add POSTROUTING rule:
4747
```bash
48+
# All traffic to local network will be hidden behind IP of the enp3s0 interface (similar to SNAT)
4849
sudo iptables -t nat -A POSTROUTING -o nebula1 -j MASQUERADE
4950
```
5051

@@ -59,6 +60,7 @@ If the default `FORWARD` policy is `DENY`, you need to enable forward traffic be
5960
```bash
6061
sudo iptables -A FORWARD -i nebula1 -o enp3s0 -j ACCEPT
6162
sudo iptables -A FORWARD -i enp3s0 -o nebula1 -m state --state ESTABLISHED,RELATED -j ACCEPT
63+
# All traffic to local network will be hidden behind IP of the enp3s0 interface (similar to SNAT)
6264
sudo iptables -t nat -A POSTROUTING -o enp3s0 -j MASQUERADE
6365
```
6466
The previous commands enable any traffic from the cloud server to any IP in a local network.
@@ -67,6 +69,14 @@ To enable specific traffic from cloud server only, run instead of the first comm
6769
# If you want to enable to call port 80 on IP 172.16.100.184 only
6870
sudo iptables -A FORWARD -i nebula1 -p tcp -o enp3s0 -d 172.16.100.184 --dport 80 -j ACCEPT
6971
```
72+
If the default `FORWARD` policy is `DENY`, you need to enable ongoing forwarded traffic from the local network to the nebula network as well:
73+
```bash
74+
sudo iptables -A FORWARD -i enp3s0 -o nebula1 -j ACCEPT
75+
sudo iptables -A FORWARD -i nebula1 -o enp3s0 -m state --state ESTABLISHED,RELATED -j ACCEPT
76+
# Not needed, if run the following command, all traffic comes from any IP in the local network will be visible in nebula network as traffic from IP of the nebula1 interface
77+
sudo iptables -t nat -A POSTROUTING -o nebula1 -j MASQUERADE
78+
```
79+
7080
### Generate Nebula certificate
7181
When generating Nebula certificate for local server, you need include `-subnets` argument with your local network CIDR, for example:
7282
```bash

0 commit comments

Comments
 (0)