0

I have a ruby server running , based on the following repository https://github.com/BuffaloWill/oxml_xxe

I am running Ubuntu without vnc installed. I tried to access the server via my public ip and couldn't proceed with it. I also searched for the code block to edit the localhost ip , which ended up unsuccessful.

So is there any method so that I can forward the 127.0.0.1 to my publicip , such a way I can access it from my local machine

Joel Deleep
  • 125
  • 1
  • 1
  • 7
  • If you're trying to reach the public IP and it's failing and assuming you haven't set up any forwards yet.. you need to forward the public IP to your internal IP (not localhost, localhost isn't routable). Also, you need to look into [hairpin NAT](https://serverfault.com/questions/55611/loopback-to-forwarded-public-ip-address-from-local-network-hairpin-nat) –  May 19 '20 at 16:18
  • I have no internal IP configure in my server , I have only the public IP which I used to access the server via ssh. – Joel Deleep May 19 '20 at 16:26

1 Answers1

1
sysctl -w net.ipv4.ip_forward=1
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j DNAT --to-destination 127.0.0.1:80

You can use iptables to forward request to local. But my recommendation is change listen address local to global. Adding layer is not efficient. You can found more details for iptables from there

Open server.rb and add set :bind, 'yourip' confing to after requirements which is line 12 . I hope this will be work.

  • if you are saying the i should change the listen address from 127.0.0.1 to a global one , as i mentioned in the post , i am unable to do that . The reason is I couldnt find the code where I can change the listening IP – Joel Deleep May 19 '20 at 16:23
  • i tried adding the set : bind, 'myip' but i couldnt access. But initially i did the iptables method you answered and didnt remove the rule , is that the problem ? – Joel Deleep May 20 '20 at 09:19