Skip to content

Instantly share code, notes, and snippets.

@sokomo
Last active April 7, 2022 17:37
Show Gist options
  • Save sokomo/3c0ecf29fc3e537d23288424473d1fcb to your computer and use it in GitHub Desktop.
Save sokomo/3c0ecf29fc3e537d23288424473d1fcb to your computer and use it in GitHub Desktop.
|-------------------------------| |----------------------------------|
| SYN | | TCU |
|-------------------------------| |----------------------------------|
| | | |
| Wifi (en0): 192.168.1.100/24 | | |
| |_______________________| |
| Ethernet (en1): 192.168.5.1 _________________________ Ethernet (eth0): 192.168.5.2 |
| | | |
| | | |
| TUN wifi (gre0): 10.0.0.1 ------------------------- SYN Wifi Tun (gre0): 10.0.0.2 |
| | | |
|-------------------------------| |----------------------------------|
Demo command:
SYN:
ifconfig gre0 create
ifconfig gre0 10.0.0.1 10.0.0.2 link1 up
ifconfig gre0 tunnel 192.168.5.1 192.168.5.2
sysctl -w net.inet.ip.forwarding=1
echo "nat on en0 from 10.0.0.0/24 to any -> (en0)" | pfctl -f -
TCU:
ip tunnel add gre0 mode gre remote 192.168.5.1 local 192.168.5.2 ttl 64 dev eth0
ip addr add dev gre0 10.0.0.2 peer 10.0.0.1/32
ip link set gre0 up
ip route add default via 10.0.0.2
ping 8.8.8.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment