I currently have two VM's set up in the following manner:

      /-----------------\      |  Ubuntu VM            |      /---------------\
      |   Workstation   |------|  eth1 : 192.168.0.x   |      |  Web Server   |
      |   192.168.0.x   |      |  eth0 : 169.254.71.x  |------| 169.254.71.x  |
      \-----------------/      |                       |      \---------------/

And I am having some trouble accessing the web server from my local machine.

The ubuntu is configured through virtualbox to have 2 network adapters, the first set to internal network, and the second set to a bridged connection. This gives me two wired connections once inside the vm, and I set the first one (corresponding to the internal network) as 'link local only', and the second as automatic DHCP.

The webserver is running turnkey linux LAMP os, with the network adapter configured to internal network, with the network having the same name as the ubuntu internal network.

I have followed this tutorial (switching eth0 and eth1 where appropriate) to enable me to ping from the webserver to the outside world. I can ping to both my local machine and any website on the internet from the webserver.

Now my problem comes from trying to do the reverse of above. I have been trying to no avail for quite some time, using resourses such as this and a couple others to enable me to connect to the webserver from my local machine. When I try to ping the 169.254.71.x address of my webserver, it doesn't connect.

I realize that my problem is probably in my NAT configuration on the ubuntu machine, or my port forwarding configuration on my ubuntu machine, but I do not know how to fix these issues.

  • ^ haha thanks, can't take credit for it, copied from a guide here that I've been attempting to follow :) – user3593245 Apr 11 '16 at 14:58
  • 1
    Please consider to use a real valid subnet in place of your 169.254.71.? Automatic Private Internet Protocol Addressing subnet. Issues may or may not be related to using that subnet. – Doug Smythies Apr 11 '16 at 15:16
  • Not NAT but routing preferably. However, your objective is to access the web server VM from the host system passing through Ubuntu VM? Is that right? If so, cab you not bridge the adapter for the web server and access? What is it you're trying to achieve here? – AzkerM Apr 11 '16 at 15:46
  • @AzkerM he stated in the Title: "firewall" – guntbert Apr 11 '16 at 18:27

So I ended up figuring out my problem, just posting an answer for anyone else potentially having the issue.

The command:

iptables -t nat -A PREROUTING -d outerip -p tcp --dport 80 -j DNAT --to webip

Was what eventually allowed it to work. This rule appends the prerouting table to allow connections from the outer ip of the firewall, as long as they are tcp packets destined for port 80, to be directly NAT'd across the firewall to the webserver IP.

IT should also be noted that I changed the internal facing adapter of my firewall from "link local only" to "shared with other computers" This assigned that eth adapter an address of 10.42.0.x, instead of 169.254.x.x. I'm not sure if that fixed any functionality, another user suggested that I get off the 169.254.x.x address field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.