![]() |
| | #1 |
| Super Moderator Join Date: Sep 2001
Posts: 4,680
| Using ip tables to forward port to virtual machine I need my virtual server to be accessible from remote servers. My host machine has a publically routable address and can access the virtual machine through the local (and static) address 192.168.100.254, and so I figured I could just forward a port from my host machine to the virtual machine. My host can access the virtual machine through IP address 192.168.100.254, and I want to forward any tcp traffic on port 5345 (chosen at random) to my virtual machine. So I'm trying the following iptables commands on my host. I modified commands explained at Port forwarding for iptables (DMZ), changing just the ports and the address. Code: iptables -A PREROUTING -t nat -i eth1 -p tcp --dport 5345 -j DNAT --to 192.168.100.254:80 iptables -A INPUT -p tcp -m state --state NEW --dport 5345 -i eth1 -j ACCEPT Can anyone see anything wrong with the commands above (from my limited understanding of iptables - I dont see a problem), or am I going at this the completely wrong way? edit: I have set /proc/sys/net/ipv4/ip_forward to 1 (despite previous edits with problems I was having) |
| sean is offline | |
| | #2 |
| Super Moderator Join Date: Sep 2001
Posts: 4,680
| Problem solved. I wish I could've done with iptables - because I really wanna learn more about that - but I found I tool could rinetd that runs as a server and does the forwarding for you. It has a simple config file, where all I had to say was "0.0.0.0 5345 192.168.100.254 80" and it forward any traffic on my host at port 5345 to port 80 on the virtual machine. WOO HOO! |
| sean is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting 32 bit binary IP to decimal IP (vice-versa) | Mankthetank19 | C Programming | 14 | 11-27-2008 12:53 PM |
| Virtual Tables | Unregistered | C Programming | 1 | 02-19-2002 10:02 PM |
| C++ XML Class | edwardtisdale | C++ Programming | 0 | 12-10-2001 11:14 PM |
| Exporting Object Hierarchies from a DLL | andy668 | C++ Programming | 0 | 10-20-2001 01:26 PM |