Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 11 Aug 2020 13:15:03 -0700
From:      Pete Wright <pete@nomadlogic.org>
To:        Odhiambo Washington <odhiambo@gmail.com>
Cc:        freebsd-virtualization@freebsd.org
Subject:   Re: FreeBSD a server and bhyve
Message-ID:  <0acc82ba-4779-f006-7ece-a003d0d0759c@nomadlogic.org>
In-Reply-To: <CAAdA2WPnWgC23bzMLfj4isUqmJMXd_oiytu%2BZ0FB2WyoPJ-p6w@mail.gmail.com>
References:  <CAAdA2WP0hOZUWS9WLKpb_Pvz3HKp-WPdg5Bq_QEEf8JA6=gCRw@mail.gmail.com> <1c1e71ea-9f4f-b4a6-c6bb-f7cd201c0182@gmx.at> <CAAdA2WO7apAxikMzzqq0h5An2Vao5jSruZzt4ooLfJxk9Hh0CA@mail.gmail.com> <eb836f29-b7b5-1121-d5b6-968f2748e53a@nomadlogic.org> <CAAdA2WPnWgC23bzMLfj4isUqmJMXd_oiytu%2BZ0FB2WyoPJ-p6w@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help


On 8/11/20 12:38 PM, Odhiambo Washington wrote:
>
>
> On Tue, 11 Aug 2020 at 20:23, Pete Wright <pete@nomadlogic.org 
> <mailto:pete@nomadlogic.org>> wrote:
>
>
>
>     On 8/11/20 5:49 AM, Odhiambo Washington wrote:
>     > Hi infoomatic,
>     >
>     > Looks like I have to top-post so as to not mess the thread:
>     >
>     > The reason I need a VM is because I need to totally independent
>     host,
>     > with an independent name, with access to all ports of its own.
>     > It looks like I need another public IP for that.
>
>     It depends on your use case.  I have a single IPv4 address
>     allocated to
>     one of my systems and have setup various CNAME entries in DNS that
>     all
>     resolve to the same IP.  I think that's a pretty common design
>     pattern
>     for people who colo their own servers and host multiple services
>     on them.
>
>     the tricky part will be if you want to host multiple instances of the
>     same service though (multiple webservers for example).  in that case
>     you'll most likely need multiple IPv4 address assigned to your system.
>
>
> That's exactly where I am.
> Suppose I obtained another IP for the VM, how do I make the VM the 
> only host listening on that IP then?

this should be pretty straight forward - the first step would be to 
setup the additional public IP's as virtual addresses on your NIC 
similar to this:
https://www.freebsd.org/doc/handbook/configtuning-virtual-hosts.html

then setting up your firewall (pf or ipfw) to forward requests coming in 
on one of those public IP's to the specific bhyve VM which is listening 
on a private IP.  this would be identical to hosting multiple services 
on a single IP.


here's an example pf config that does the forwarding of SMTP on port 25 
to a VM using a private IP to give you an idea of what the syntax would 
look like:
rdr pass on $ext_if inet proto tcp from any to 1.2.3.4 port = 25 -> 
10.1.0.10 port 25


hope this helps,
-pete

-- 

Pete Wright
pete@nomadlogic.org
@nomadlogicLA




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?0acc82ba-4779-f006-7ece-a003d0d0759c>