Difference between revisions of "Open5gs: NAT port forwarding"

From OnnoWiki
Jump to navigation Jump to search
(Created page with " sudo sysctl -w net.ipv4.ip_forward=1 sudo iptables -t nat -A POSTROUTING -o ens18 -j MASQUERADE sudo systemctl stop ufw sudo iptables -I FORWARD 1 -j ACCEPT # if above s...")
 
Line 1: Line 1:
 +
Berikut ini adalah untuk melakukan port forwarding agar UE mendapatkan internet dari Open5gs
 
  sudo sysctl -w net.ipv4.ip_forward=1
 
  sudo sysctl -w net.ipv4.ip_forward=1
 
  sudo iptables -t nat -A POSTROUTING -o ens18 -j MASQUERADE
 
  sudo iptables -t nat -A POSTROUTING -o ens18 -j MASQUERADE
Line 4: Line 5:
 
  sudo iptables -I FORWARD 1 -j ACCEPT
 
  sudo iptables -I FORWARD 1 -j ACCEPT
  
# if above setup not works try to manually create tun interface and do nat forwarding
+
Jika cara diatas tidak berhasil, coba tambahkan manual tun interface dan lakukan nat forwarding ulang
 
  sudo ip tuntap add name ogstun mode tun
 
  sudo ip tuntap add name ogstun mode tun
 
  sudo ip addr add 10.45.0.0/16 dev ogstun
 
  sudo ip addr add 10.45.0.0/16 dev ogstun
 
  sudo ip addr add 2001:230:cafe::1/48 dev ogstun
 
  sudo ip addr add 2001:230:cafe::1/48 dev ogstun
 
  sudo ip link set ogstun up
 
  sudo ip link set ogstun up
 +
 +
Catatan: NAT forwarding dilakukan kembali apabila core network open5gs di restart

Revision as of 13:54, 26 October 2022

Berikut ini adalah untuk melakukan port forwarding agar UE mendapatkan internet dari Open5gs

sudo sysctl -w net.ipv4.ip_forward=1
sudo iptables -t nat -A POSTROUTING -o ens18 -j MASQUERADE
sudo systemctl stop ufw
sudo iptables -I FORWARD 1 -j ACCEPT

Jika cara diatas tidak berhasil, coba tambahkan manual tun interface dan lakukan nat forwarding ulang

sudo ip tuntap add name ogstun mode tun
sudo ip addr add 10.45.0.0/16 dev ogstun
sudo ip addr add 2001:230:cafe::1/48 dev ogstun
sudo ip link set ogstun up

Catatan: NAT forwarding dilakukan kembali apabila core network open5gs di restart