0

I need help with my little setup.

I have a VM on my PC with Ubuntu 16.04.3 LTS. My home network 192.168.1.0/24. Many network namespaces with OpenVPN tunnels working. Some software that works inside netns.

What I need is to control that software from my home network by using web interface.

For example.

My VM's eth0 ip is 192.168.1.17, one of my netns veth ip is 10.1.8.1 I run a web service on port 1008 and I want to access it from 192.168.1.0 network going to 192.168.1.17:1008. I can test the service from inside VM's 192.168.. network using curl and it works alright, I can access the service by 10.1.8.1:1008. I also can ping 10.1.8.1 from my home network, but I can't access the web service outside the VM. It refuses the connection.

I tried to port forward any incoming connections to port 1008 to 10.1.8.1:1008 using iptables, but it doesn't seem to work. Port forwarding is enabled in system.

1 Answer 1

2

iptables -A FORWARD -p tcp -d 10.1.8.1 --dport 1008 -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 1008 -j DNAT --to-destination 10.1.8.1:1008

I was able to do it with iptables.

You must log in to answer this question.

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