Problem with Vbox configuration

Discussions related to using VirtualBox on Windows hosts.
Post Reply
edufissure
Posts: 79
Joined: 8. Sep 2018, 19:27

Problem with Vbox configuration

Post by edufissure »

Hi i want to make this setup:
Captura de pantalla 2021-11-08 205020.gif
Captura de pantalla 2021-11-08 205020.gif (99.48 KiB) Viewed 4352 times
Is in spanish, but quite self explanatory...
So the host is a windows 10 PC with virtualbox 6.1.26 and extension pack.
Then the first VM would be my Ubuntu that acts as a Firewall ( which is Ubuntu 18.04): Ive got in the setup of the vm vbox two network adapters one in mode bridge ( the first, to get ip dynamically from institute), and other for the internal network called cognom.

The config:

Code: Select all

auto lo
iface lo inet loopback
# enp0s3: # Interfície 1
# enp0s8: # Interfície 2

#  se activan cuando se producen eventos hotplug en las intefaces de red, como la detección de la tarjeta por parte del kernel, 
#la conexión del cable de red, etc
allow-hotplug enp0s3 enp0s8

# enp0s3: # Interfície 1
auto enp0s3
iface enp0s3 inet dhcp

auto enp0s8
iface enp0s8 inet static
	address 192.168.0.1
	netmask 255.255.255.0
	network 192.168.0.0

# enp0s3: # Interfície 1
up iptables -t nat -A POSTROUTING -o enp0s3 -s 192.168.0.0/24 -j MASQUERADE
down iptables -t nat -D POSTROUTING -o enp0s3 -s 192.168.0.0/24 -j MASQUERADE
Every client machine it doesnt matter if linux o ubuntu has the config:
Static ip address: 192.168.02
Netmask: 255.255.255.0
Gateway: 192.168.0.1

But when i connect from a client in LAN, i can ping to the other machine, and the 192.168.0.1.. but i cant ping or access internet.

How can i do this ??
Somehow NAT isnt working....
For make things easy, we can suppose that the client is also an Ubuntu 18.04 machine.

Code: Select all

auto lo
iface lo inet loopback
# enp0s3: # Interfície 1

allow-hotplug enp0s3 

auto enp0s3
iface enp0s3 inet static
	address 192.168.0.5
	netmask 255.255.255.0
        gateway 192.168.0.1
	network 192.168.0.0
My idea is tha a client could access internet.

Thanks
BillG
Volunteer
Posts: 5102
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: Problem with Vbox configuration

Post by BillG »

That probably has nothing to do with VirtualBox. If the vm client can ping the gateway address, its networking is OK. What is supposed to be doing NAT in the firewall/router vm between the 192.168.0.0 internal network and the 192.168.21.0 external network?
Bill
edufissure
Posts: 79
Joined: 8. Sep 2018, 19:27

Re: Problem with Vbox configuration

Post by edufissure »

I want to make ping to internet from a client in my LAN.
Virtualbox says thats ok.
In other forums people say that netowrk configuration in ubuntu and iptables are ok...
But the true is that doesnt work.
I suspect that iptables doesnt work in firewall.

Any ideas would be apreciated

Thanks
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Problem with Vbox configuration

Post by scottgus1 »

What you're setting up is a "sandbox", in a sense. Please see Virtualbox Networks: In Pictures: "Sandbox".

The Ubuntu firewall VM has to provide router services (and DHCP, if you want the internal networked VMs to get IP addresses from the firewall VM.

If you disconnect the drive file for the Ubuntu firewall out of the firewall VM and insert a new drive file, then install and configure pfSense on it per the Sandbox tutorial, you will be able to see if the problem is in Virtualbox or inside the Ubuntu firewall configuration.

Just one other thing to point out, if the problem is in the firewall OS's configuration, it has to be solved by using Ubuntu's help channels, not here on the Virtualbox forum. We can help with the network configurations of the Virtualbox settings and how the VM's are running. But we don't necessarily grok Ubuntu firewall settings.
edufissure
Posts: 79
Joined: 8. Sep 2018, 19:27

Re: Problem with Vbox configuration

Post by edufissure »

I have asked also in AskUbuntu, but they dont see anything wrong with it...so i suppose its something related with virtualbox,as i dont know the error where is, perhaps in some configuration of vbox, perhaps a bug in networking, perhaps a config problem in Ubuntu. Everything is open ;)

https://askubuntu.com/questions/1374531 ... 68_1374531
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Problem with Vbox configuration

Post by scottgus1 »

OK, let's look at the Virtualbox setup and the OSs' IP reports.
  • For each VM, Right-click the VM in the main Virtualbox window's VM list, choose Show in Explorer/Finder/File Manager. Zip the VM's .vbox file (not the .vbox-prev file), and post the zip file, using the forum's Upload Attachment tab. (Configure your host OS to show all extensions if the folder that opens does not show a .vbox file.)
  • For each Windows OS, host or VM, provide the command output of:

    ipconfig /all
  • For each Linux OS, provide the command output of:

    ifconfig or ip address
  • Finally, please run these commands on the host and provide the output:

    CD "C:\Program Files\Oracle\Virtualbox"
    vboxmanage list bridgedifs
edufissure
Posts: 79
Joined: 8. Sep 2018, 19:27

Re: Problem with Vbox configuration

Post by edufissure »

Sorry for the dely ive been busy these days...i finally found the solution-
Here is the solution: https://askubuntu.com/questions/1374531 ... 61#1376661
Main reason gateway should not be configured and i wrote -a instead -A to add a rule to iptables.

Thanks to all that gave me support.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Problem with Vbox configuration

Post by scottgus1 »

Great! Glad you're up and running.
Post Reply