I'm running VirtualBox for a class lab, and VirtualBox on Ubuntu appears to be missing the "Bridge Interface" feature for a network adapter - so the instructions we were given won't work for me, and the TA's don't know much about IP tables, so I'm pretty much on my own to get this working.
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
The commands appear to execute successfully, but localhost:5345 and a similar request from a remote machine recieve no response. I haven't done anything else to the default iptables in Ubuntu, and the policy for FORWARD, INPUT and OUTPUT are all 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)