Hi,
In Virtual Box I've installed Fedora 17 and setup LAMP development environment. I've set the static ip to access the localhost and the applicaions/projects. Now I would like to configure it as to access them using the static IP from the host machine (Windows 7 OS). How can I do this? Please elaborate.

Thanks in advance.

Dani AI

Generated

As pointed out, the networking mode you choose in VirtualBox controls whether the host can reach the guest. As suggested, NAT + port‑forwarding is one option, but there are three practical approaches depending on your needs:

  • Bridged Adapter — makes the VM appear as another machine on your LAN (easiest if you want any machine on the local network, including the Windows 7 host, to hit the VM’s static IP).
  • NAT + Port Forwarding — keeps the VM behind NAT but forwards a host port (e.g. 8080) to the guest’s port 80; useful when you want to keep NAT but still access HTTP from the host.
  • Host‑Only (or dual‑adapter: NAT + Host‑Only) — creates a private host↔guest network (safe and simple if only the host must access the guest, while NAT provides internet access).

Concrete steps and checks

Bridged: Power off the VM → VirtualBox Settings → Network → Attach to: Bridged Adapter → pick the host NIC → boot VM. Inside the guest confirm the IP (e.g. ip addr show or ifconfig) and test from Windows: ping <guest-ip> then browse to http://<guest-ip>.

NAT + port forwarding: VirtualBox Settings → Network → Adapter (NAT) → Advanced → Port Forwarding. Add a rule such as:

Name: http
Protocol: TCP
Host IP: 127.0.0.1
Host Port: 8080
Guest IP: <guest-ip>    (optional)
Guest Port: 80

Then open http://localhost:8080 on the Windows host.

Host‑only / dual adapter: Add a Host‑Only adapter in VirtualBox, give the guest a static IP on that host‑only subnet (e.g. 192.168.56.101), keep NAT on the other adapter for internet, then browse to http://192.168.56.101.

Troubleshooting checklist

  • Verify Apache is listening externally: sudo netstat -tulpn | grep :80 (or ss -ltnp | grep :80). Ensure Listen in Apache config is not bound to 127.0.0.1 only.
  • Check guest firewall (iptables/firewalld) allows port 80 and SELinux isn’t blocking web content (getenforce — temporarily setenforce 0 to test).
  • If bridging over Wi‑Fi fails, try Host‑Only or bridge the wired NIC.
  • Test from the guest first (curl -I http://localhost) to isolate webserver vs networking issues.

Recommended: for quick access use Bridged if you want full LAN visibility; use Host‑Only (with NAT for internet) if you want host-only access and isolation.

Recommended Answers

All 2 Replies

Did you configure your VirtualBox network interface to use a NAT address, or a bridged address?

Like Rubberman aluded to, if the networking is set to NAT, then you can port forward a specific port (i.e. tcp/80 tcp/443) from the host machine IP into the virtual machines private IP. That is done right in the Virtual machine's networking section.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.