0

When I connect to my external IP in linux, it gets forwarded to my gateway (router).

But I need to run a server, so I need to be able to forward requests to my external IP to my computers ip address.

How do I do this in linux?

For example:

I connect to 10.0.0.3 (not my real external IP), but I want that to be forwarded to IP 192.168.1.3

3
  • 1
    This is a function of your router. It's called port forwarding.
    – Tyson
    Apr 25, 2015 at 1:02
  • Yeah I tried with my router, but that only works for connections from WAN side, so anything that happens in my local network doesn't apply
    – user
    Apr 25, 2015 at 1:04
  • You need to open a port in your router and link it with a host in your local network (192.168.1.3 ) so packets will be forwarded to that host, search in Google : port forwarding + your router's model.for tutorials as you didn't provide the model
    – Suzana
    Apr 25, 2015 at 2:05

1 Answer 1

1

Alright I managed to do it.

I added an iptable rule on my linux server:

iptables -t nat -A OUTPUT -d [external ip] -p all -j DNAT --to-destination [server local ip]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .