J
J
JakeHost2021-05-03 10:24:12
ubuntu
JakeHost, 2021-05-03 10:24:12

How to forward a port to my computer with a gray IP?

Hello!
I have a computer with a gray IP (they don't give a white one). There is a server in Germany (Oracle Cloud) with a white IP.
I installed L2TP on this server without any mikrotiks, etc. Now the question arose: How to forward a port to my computer with a gray IP? The required port is 3314. I opened it in IPTABLES and in the VCN settings (this is a network, you can configure open ports in the security lists there.). Now I need to somehow forward it to my computer with a gray IP when I'm online on the network. The local IP is given to me one, as far as I remember 10.8.0.3. The server itself has a local IP of 10.8.0.2. If there's anything else I need to write, I'll write it. Thank you!\
PS I forgot to write, l2tp connect via router.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
alegzz, 2021-05-03
@alegzz

1. enable forwarding, if disabled:
find
#net.ipv4.ip_forward=1 in /etc/sysctl.conf
and uncomment it. if =0, then change to =1
2. create rules and save:
iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 3314 -j DNAT --to-destination 10.8.0.3:3314
iptables -A FORWARD -p tcp -d 10.8.0.3 --dport 3314 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
the second rule is not needed if there is a general rule to allow forward
3. configure port forwarding on the router

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question