0

Good morning, I'm currently working on the creation of a web server. Here is my setup :

  • MacbookPro running -> VirtualBox
  • VirtualBox running -> Debian 10.04 (only command line)
  • Docker with -> Nginx & PHP images/containers

I set up everything without a problem (or at least finding solutions to all of my occuring problems) but now that I am trying to set up a firewall (UFW or simply iptables) to allow connections only from specific IP addresses I'm having troubles.

I followed some tutorial on how to setup the firewall and I found EliTheComputerGuy -> video in which he explains that if your VirtualBox VM is connected to your network in Bridge WI-FI you cannot specify which IP addresses are allowed or not onto your server. You can only accept ALL connections to any or a specific ports. But if you are connected in Bridge Ethernet then you can specify which IP address is allowed on which port. He doesn't give any reason as to why this happens. He apparently does not know himself.

When I try to specify for example (7655 is my ssh port)

sudo ufw allow from 192.168.0.39 to any port 7655 (My Host machine's address)

or trying to add an entire subnet

sudo ufw allow from 192.168.0.0/24 to any port 7655 (allowing connection from 192.168.0.0 to 192.168.0.255)

I do not get any error but when I try to connect with ssh into the VM from my host machine after adding this rule I get a packet_write_wait: Connection to 192.168.0.22 port 7655: Broken pipe. Here 192.168.0.22being my VM's IP address

I tried solving the Broken pipe error but I don't think that this is where the problem begins.

Now I am wondering if any of you could help me understand what is happening and maybe help me solve this "mystery". If I have left out some important information please let me know and I'll update the thread :)

Thank you for your time.

2
  • Sorry, I thought it would be clearer this way. The first IP is the address from which I allow a connection and it would be 192.168.0.39 (My Macbook's address). The second IP address is a subnet so it was 192.168.0.0/24 which means that I allow connection from 192.168.0.0 to 192.168.0.255. The 3rd one is the IP I'm trying to reach when I try to SSH into the VM from my host machine. I hope that makes it clearer. Commented Sep 9, 2020 at 22:30
  • @roaima it's the opposite. 192.168.0.39 is my host machine and 192.168.0.22 is my VM Commented Sep 9, 2020 at 22:38

0

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.