webservervirtualboxvirtualizationbridging

How to reach web server within a VM?


I'm using virtualbox to set up two VMs, one debian one fedora. Both are configured with network acces through bridge, and from each VM I can reach 127.0.0.1 through mozzila.

Here comes the trouble, I can reach the debian one just fine through its IP, which I got from /sbin/ifconfig -> eth0.

I made the same thing with fedora (just the first field):

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.21  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 2a01:cb1c:52e:a000:320c:4fe:d697:6b11  prefixlen 64  scopeid 0x0<global>
        inet6 fe80::6594:672d:7f76:4ff7  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:13:19:a2  txqueuelen 1000  (Ethernet)
        RX packets 6339  bytes 4615766 (4.4 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 2762  bytes 355751 (347.4 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Now, I read online enp0s3 is just a new naming norm (https://askubuntu.com/questions/704035/no-eth0-listed-in-ifconfig-a-only-enp0s3-and-lo) and should be just fine.

The trouble is I can't reach 192.168.1.21 through the host system (namely win 10) or least, it doesn't give the the generated html it should.

Both VMs have guest additions installed, and the vbox files are the same (except for mac and ethernet adresses)

pastebins of debian vbox and fedora vbox conf files :

https://pastebin.com/WuyCTwcn deb

https://pastebin.com/jRDQEwJz fedora

(I can't think of better tags now, feel free to change or suggest)


Solution

  • In the end, it was Fedora's firewall doing its job.

    To maintain the firewall and still making use of the webserver, I had to run the following command :

    # firewall-cmd --add-service=http
    

    and then

    # firewall-cmd --add-service=https
    

    just in case I want to use https later.

    edit & note : if you want the changes to be permanent, you have to add the --permanent option. To be fair, I must still look at the --zone=public option, in case you use these instruction as reference, look what they do before messing something's up :)