Using firewall in ubuntu guest

Discussions related to using VirtualBox on Windows hosts.
Post Reply
DTom
Posts: 2
Joined: 8. Feb 2013, 13:59

Using firewall in ubuntu guest

Post by DTom »

Hi,

I have windows 7 pro host with ubuntu server 12.10 as guest. The host has a static ip. The networking mode is NAT with port forwarding from host port 22 to guest port 22. I don't want to use use bridged networking because of company policies.

I need to ssh (port: 22) into the guest from the internet and I want to limit inbound connections to guest port 22 to certain ip addresses. So I enabled ufw in the guest and added rules to it. When I try to ssh into the guest from one of the allowed ip addresses, it's not connecting. If I disable ufw, it works.

What could be wrong? I don't know much about NAT and guest firewalls.

Thanks in advance for your response.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Using firewall in ubuntu guest

Post by noteirak »

If you say that it works without ufw, then there is nothing wrong with Virtualbox, and this is the wrong place to post your issue.
We only support Virtualbox-related issues, so the best would be to post on a networking, linux or security forum.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
DTom
Posts: 2
Joined: 8. Feb 2013, 13:59

Re: Using firewall in ubuntu guest

Post by DTom »

I found the problem. The guest always receives the ip: 10.0.2.2 no matter who connects to it. I disabled firewall on the guest added the same ip restriction rules to the virtualbox entry in the host windows firewall and it worked. My question is if I install a web server in the guest, won't it be able to detect the actual ip address of the client who's connecting to it?
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Using firewall in ubuntu guest

Post by noteirak »

No you won't, that is how the NAT mode works: The virtualbox engine acts like a proxy, the host or the guest (or anything around them) will never know where it came from or to.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
Post Reply