FreeBSD as a router

I have VirtualBox working under FreeBSD-10.0 with GNOME desktop with three Ethernet cards. Now I plan to install FreeBSD-10.0 as a router under VirtualBox because of lack of hardware.

I will be creating a few jails under the host desktop system that I hope can be seen by the VirtualBox FreeBSD router guest.

Is this possible? I’m thinking to dedicate one Ethernet card to the guest that will be hooked up to the internet. Maybe even dedicating one cpu out of my 4-core for the guest. I want to configure the host desktop system to totally by-pass this Ethernet card so that only the guest has use of it. Is this possible?
 
max21 said:
I have VirtualBox working under FreeBSD-10.0 with GNOME desktop with three Ethernet cards. Now I plan to install FreeBSD-10.0 as a router under VirtualBox because of lack of hardware.

I will be creating a few jails under the host desktop system that I hope can be seen by the VirtualBox FreeBSD router guest.

Is this possible? I’m thinking to dedicate one Ethernet card to the guest that will be hooked up to the internet. Maybe even dedicating one cpu out of my 4-core for the guest. I want to configure the host desktop system to totally by-pass this Ethernet card so that only the guest has use of it. Is this possible?
How do people come up with such ideas :\ ?
 
@max21, can you describe what your goal is in a more general sense? That way others might suggest alternative (better) ways to accomplish what your trying to do. I suspect something with only jails or bhyve will do a better job.
 
Last edited by a moderator:
Hi @max21, with VirtualBox, it is not possible to remove a network card from the host system and completely dedicate it to a virtual machine.

Like @jrm, I believe there may be better ways to achieve your goal. There is nothing to prevent you from running network services on your host installation and it is probably going to make sense to manage the routing and firewall on the host system anyway. If you wanted to isolate some network services, such as DNS or DHCP servers, FreeBSD jails would be a great way to achieve something similar to running a FreeBSD virtual machine on top of your FreeBSD host in VirtualBox and is a much less resource hungry approach. Have a read of the handbook to see whether these are for you. I would recommend the sysutils/ezjail port for straightforward setup.

Basic jails will likely be enough for you. More advanced jail configuration can use Vnet-enabled jails to fully dedicate a network card to a jail, with its own network stack, which is what you said you wanted. However, I don't know whether the Vimage/Vnet code is ready for a production system, and haven't used it myself. @DrH had success using setfib(2) with jails to use a separate routing table for his jail without it being Vnet-enabled, which might be useful to you, depending on your requirements. Have a look at Thread 46753.
 
Last edited by a moderator:
asteriskRoss, it was only a idea of how to do it on a single machine. I’m no expert. I kind of knew it would not work but I needed to know for sure. Your post is deeper than I imagine about using jail to do the job. I Thank You so much, and I am so happy that jrm easily weeded out the question than provided a possible solution that you just explained in details.

I suspect something with only jails or bhyve will do a better job.
So there is a possible way, but not the vBox way I was wondering about.

A simple answer to a simple question ... without the flames design to insult.

Thanks you both
 
max21 said:
I’m no expert.
Who is? :) This forum is all about FreeBSD users helping each other.

max21 said:
I kind of knew it would not work but I needed to know for sure.
Using VirtualBox isn't a totally crazy idea and would work if you wanted it to. You can use "bridged mode" for the network card and with some routing configuration on the host could effectively (though not actually) dedicate a card to the virtual machine. If you wanted to run a Windows server on top of FreeBSD, this would be a reasonable solution. Since you want a FreeBSD virtual machine you have more (and in my opinion better) options. I've not tried @jrm's suggestion of byhve. It's not as lightweight as jails, but is more flexible in that you can run different operating system versions as guests.

max21 said:
Thank You so much
You're very welcome. Good luck with your project.
 
Last edited by a moderator:
Back
Top