Score:0

access web server on private network

kg flag

I would like to access a web server(10.0.0.3) on private network via other machine, that has connection to the private network(10.0.0.2) and has a public ip too(23.88.XXX.XXX). I am trying with this, but it is not working yet:

iptables -t nat -A PREROUTING -i eth0 -p tcp -d 23.88.XXX.XXX --dport 80 -j DNAT --to 10.0.0.3:80
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

Can anybody help me, what I am doing wrong?

Thanks in advance!

Carlo avatar
cn flag
Are you trying to access service over lan or wan? Is webserver running on 10.0.0.3? Maybe you can turn firewall off for testing and check again.
user1560141 avatar
kg flag
I am trying to access the service over wan from my home computer. The server is running on 10.0.0.3 and as far as I know, there is no firewall none of them, they are newly installed debian computers.
Carlo avatar
cn flag
Can you access web server from lan ? http://10.0.0.3
user1560141 avatar
kg flag
Yes, I can ping it.
Carlo avatar
cn flag
If you open browser on 10.0.0.2 and go to http ://10.0.0.3 do you see webpage?
user1560141 avatar
kg flag
I can't try it, because this private network is in a cloud. I can just ssh into 23.88.XXX.XXX, and I can ssh from 23.88.XXX.XXX to 10.0.0.3. I've installed apache on the web-server, before I removed the public IP of it.
Carlo avatar
cn flag
Ssh to 10.0.0.2 and run command "curl 10.0.0.3" without quotation marks. Do you see any html output?
user1560141 avatar
kg flag
Yes, I see the HTML output of the apache server.
Carlo avatar
cn flag
What cloud provider are you using?
user1560141 avatar
kg flag
I use hetzner cloud
us flag
Have you enabled IP packet formwarding on `10.0.0.2`?
user1560141 avatar
kg flag
Yes, I enabled ip4 forwarding on 10. 0.0.2
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.