Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Dec 2022 16:27:06 -0600
From:      Leif Pedersen <leif@ofwilsoncreek.com>
To:        Rob Ballantyne <robballantyne3@gmail.com>
Cc:        freebsd-cloud@freebsd.org
Subject:   Re: What is a VPC (google's specifically but it could be more general) really?
Message-ID:  <CAK-wPOhK1gX5%2BV1Z9nNauRF-oC85Jc-vmi-bKq_-YTKVt10C8Q@mail.gmail.com>
In-Reply-To: <CAKLrb5do6Evnn2WKKeAsUJrHWExCp5N=QF5wvTituoFyYmOc0A@mail.gmail.com>
References:  <CAKLrb5do6Evnn2WKKeAsUJrHWExCp5N=QF5wvTituoFyYmOc0A@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--0000000000008aeee105efe55c4d
Content-Type: text/plain; charset="UTF-8"

Hi,

I don't have a direct answer, but as a user I can confirm that OpenVPN in
layer 3 mode works for me. I simply haven't tried it in layer 2 mode with
GCE (because I've no need for layer 2 and it incurs the extra overhead of
broadcast packets). Layer 2 mode probably won't work anyway because the MTU
has to be reduced to 1460, unless you do that on all participating hosts.
Point is, if that's an option for you it might be worth exploring.

As a side note, I configure the tun devices with the same IP address at the
vtnet device. That actually works perfectly, even though the two endpoints
are on wildly different networks, and avoids maintaining DNS entries and
routes for the point to point network.

For example:
vtnet0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0
mtu 1460
    inet 10.1.2.3 netmask 0xffffffff broadcast 10.1.2.3
    inet 130.x.x.x netmask 0xffffffff broadcast 130.x.x.x
tun5000: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> metric 0 mtu 1500
    inet 10.1.2.3 --> 10.16.0.1 netmask 0xffffffff

(The internal IP on my home router's ethernet interface is 10.16.0.1/16,
overlapping with its tun interface.)

-Leif





On Thu, Dec 15, 2022 at 4:03 PM Rob Ballantyne <robballantyne3@gmail.com>
wrote:

> Hello,
>
>   I have a question about what the internal structure and forwarding is
> within Google's VPCs.
>
>   I started into a project using OpenVPN to bind my home network to an
> isolated VPC in Google's Cloud when I discovered the routing didn't work
> quite the way I thought.  I had assumed that VPCs would look like a private
> VLAN (Layer2) into which Google's infrastructure would inject L3 router
> interfaces and/or ip/ethernet filters.
>
>   I set up a private VPC and two test FreeBSD boxes to test and see
> exactly how VPC configures routing.
>
>   First, I just used a standard install of 13.1 and the routing table
> after everything is up and configured looks like:
>
> ----
> Internet:
> Destination        Gateway            Flags     Netif Expire
> default            10.1.1.1           UGS      vtnet0
> 10.1.1.1           link#1             UHS      vtnet0
> 10.1.1.20          link#1             UH          lo0
> 127.0.0.1          link#2             UH          lo0
> ----
>
>   This looked a little unusual to me so (there was no link local route for
> all the addresses in the VPC), I commented out the rc.conf entry
> 'google_network_daemon_enable=YES' and setup the vtnet0 interface up
> manually with: 'ifconfig_vtnet0="inet 10.1.1.20 netmask 255.255.255.0"'
> The resulting routing table:
>
> ----
> Internet:
> Destination        Gateway            Flags     Netif Expire
> 10.1.1.0/24        link#1             U        vtnet0
> 10.1.1.20          link#1             UHS         lo0
> 127.0.0.1          link#2             UH          lo0
> ----
>
>   This configuration wasn't able to communicate. The latter routing table
> looks more usual though, with a 10.1.1.0/24 route to the local link.
>
>   So, it appears to me that VPCs are really configured to be a
> point-to-point (star really) network where the Google router interface
> (10.1.1.1 in this case) has to handle all forwarding between nodes of a
> network.
>
>   I've searched around the web to try and confirm this but there is scant
> detail on how exactly forwarding works within a single VPC.
>
>   My VPN project involved using a bastion VPN host that would have
> terminated the VPN/SSL tunnel and routed traffic between my home network
> and the isolated network behind the bastion.
>
>   Before I make final decisions on configuration, I wanted to know if my
> understanding is correct and whether there is any documentation on this
> that I've somehow missed.
>
>   FreeBSD is, of course, the host of choice for this operation!
>
>   If anyone does know any details, any info would be greatly appreciated.
>
> Many Thanks,
> Rob Ballantyne
>

--0000000000008aeee105efe55c4d
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<div><br></div><div>I don&#39;t have a direct answer, b=
ut as a user I can confirm that OpenVPN in layer 3 mode works for me. I sim=
ply haven&#39;t tried it in layer 2 mode with GCE (because I&#39;ve no need=
 for layer 2 and it incurs the extra overhead of broadcast packets). Layer =
2 mode probably won&#39;t work anyway because the MTU has to be reduced to =
1460, unless you do that on all participating hosts. Point is, if that&#39;=
s an option for you it might be worth exploring.</div><div><br></div><div>A=
s a side note, I configure the tun devices with the same IP address at the =
vtnet device. That actually works perfectly, even though the two endpoints =
are on wildly different networks, and avoids maintaining DNS entries and ro=
utes for the point to point network.</div><div><br></div><div>For example:<=
/div><div>vtnet0: flags=3D8943&lt;UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULT=
ICAST&gt; metric 0 mtu 1460<br></div><div>=C2=A0 =C2=A0 inet 10.1.2.3 netma=
sk 0xffffffff broadcast 10.1.2.3<br>=C2=A0 =C2=A0 inet 130.x.x.x netmask 0x=
ffffffff broadcast 130.x.x.x<br>tun5000: flags=3D8051&lt;UP,POINTOPOINT,RUN=
NING,MULTICAST&gt; metric 0 mtu 1500<br>=C2=A0 =C2=A0 inet 10.1.2.3 --&gt; =
10.16.0.1 netmask 0xffffffff<br></div><div><br></div><div>(The internal IP =
on my home router&#39;s ethernet interface is <a href=3D"http://10.16.0.1/1=
6">10.16.0.1/16</a>, overlapping with its tun interface.)</div><div><br></d=
iv><div>-Leif</div><div><br></div><div><br></div><div><br></div><div><br></=
div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_at=
tr">On Thu, Dec 15, 2022 at 4:03 PM Rob Ballantyne &lt;<a href=3D"mailto:ro=
bballantyne3@gmail.com" target=3D"_blank">robballantyne3@gmail.com</a>&gt; =
wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=
=3D"ltr"><div class=3D"gmail_default" style=3D"font-family:monospace,monosp=
ace">Hello,</div><div class=3D"gmail_default" style=3D"font-family:monospac=
e,monospace"><br></div><div class=3D"gmail_default" style=3D"font-family:mo=
nospace,monospace">=C2=A0 I have a question about what the internal structu=
re and forwarding is within Google&#39;s VPCs.</div><div class=3D"gmail_def=
ault" style=3D"font-family:monospace,monospace"><br></div><div class=3D"gma=
il_default" style=3D"font-family:monospace,monospace">=C2=A0 I started into=
 a project using OpenVPN to bind my home network to an isolated VPC in Goog=
le&#39;s Cloud when I discovered the routing didn&#39;t work quite the way =
I thought.=C2=A0 I had assumed that VPCs would look like a private VLAN (La=
yer2) into which Google&#39;s infrastructure would inject L3 router interfa=
ces and/or ip/ethernet filters.</div><div class=3D"gmail_default" style=3D"=
font-family:monospace,monospace"><br></div><div class=3D"gmail_default" sty=
le=3D"font-family:monospace,monospace">=C2=A0 I set up a private VPC and tw=
o test FreeBSD boxes to test and see exactly how VPC configures routing.=C2=
=A0=C2=A0</div><div class=3D"gmail_default" style=3D"font-family:monospace,=
monospace"><br></div><div class=3D"gmail_default" style=3D"font-family:mono=
space,monospace">=C2=A0 First, I just used a standard install of 13.1 and t=
he routing table after everything is up and configured looks like:</div><di=
v class=3D"gmail_default" style=3D"font-family:monospace,monospace"><br></d=
iv><div class=3D"gmail_default" style=3D"font-family:monospace,monospace">-=
---</div><div class=3D"gmail_default" style=3D"font-family:monospace,monosp=
ace">Internet:<br>Destination =C2=A0 =C2=A0 =C2=A0 =C2=A0Gateway =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Flags =C2=A0 =C2=A0 Netif Expire<br>default =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A010.1.1.1 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 UGS =C2=A0 =C2=A0 =C2=A0vtnet0<br>10.1.1.1 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 link#1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 UHS =C2=A0 =
=C2=A0 =C2=A0vtnet0<br>10.1.1.20 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0link#1 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 UH =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0lo0<br>127.0.0.1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0link#2 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 UH =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0lo0<br=
></div><div class=3D"gmail_default" style=3D"font-family:monospace,monospac=
e"><div class=3D"gmail_default">----</div><br></div><div class=3D"gmail_def=
ault" style=3D"font-family:monospace,monospace">=C2=A0 This looked a little=
 unusual to me so (there was no link local route for all the addresses in t=
he VPC), I commented out the rc.conf entry &#39;google_network_daemon_enabl=
e=3DYES&#39; and setup the vtnet0 interface up manually with: &#39;ifconfig=
_vtnet0=3D&quot;inet 10.1.1.20 netmask 255.255.255.0&quot;&#39;=C2=A0 The r=
esulting routing table:</div><div class=3D"gmail_default" style=3D"font-fam=
ily:monospace,monospace"><br></div><div class=3D"gmail_default" style=3D"fo=
nt-family:monospace,monospace">----</div><div class=3D"gmail_default" style=
=3D"font-family:monospace,monospace">Internet:<br>Destination =C2=A0 =C2=A0=
 =C2=A0 =C2=A0Gateway =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Flags =C2=A0=
 =C2=A0 Netif Expire<br><a href=3D"http://10.1.1.0/24" target=3D"_blank">10=
.1.1.0/24</a> =C2=A0 =C2=A0 =C2=A0 =C2=A0link#1 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 U =C2=A0 =C2=A0 =C2=A0 =C2=A0vtnet0<br>10.1.1.20 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0link#1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 UH=
S =C2=A0 =C2=A0 =C2=A0 =C2=A0 lo0<br>127.0.0.1 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0link#2 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 UH =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0lo0<br></div><div class=3D"gmail_default" style=3D"font-fa=
mily:monospace,monospace">----</div><div class=3D"gmail_default" style=3D"f=
ont-family:monospace,monospace"><br></div><div class=3D"gmail_default" styl=
e=3D"font-family:monospace,monospace">=C2=A0 This configuration wasn&#39;t =
able to communicate. The latter routing table looks more usual though, with=
 a <a href=3D"http://10.1.1.0/24" target=3D"_blank">10.1.1.0/24</a> route t=
o the local link.</div><div class=3D"gmail_default" style=3D"font-family:mo=
nospace,monospace"><br></div><div class=3D"gmail_default" style=3D"font-fam=
ily:monospace,monospace">=C2=A0 So, it appears to me that VPCs=C2=A0are rea=
lly configured to be a point-to-point (star really) network where the Googl=
e router interface (10.1.1.1 in this case) has to handle all forwarding bet=
ween nodes of a network.</div><div class=3D"gmail_default" style=3D"font-fa=
mily:monospace,monospace"><br></div><div class=3D"gmail_default" style=3D"f=
ont-family:monospace,monospace">=C2=A0 I&#39;ve searched around the web to =
try and confirm this but there is scant detail on how exactly forwarding wo=
rks within a single VPC.</div><div class=3D"gmail_default" style=3D"font-fa=
mily:monospace,monospace"><br></div><div class=3D"gmail_default" style=3D"f=
ont-family:monospace,monospace">=C2=A0 My VPN project involved using a bast=
ion VPN host that would have terminated the VPN/SSL tunnel and routed traff=
ic between my home network and the isolated network behind the bastion.</di=
v><div class=3D"gmail_default" style=3D"font-family:monospace,monospace"><b=
r></div><div class=3D"gmail_default" style=3D"font-family:monospace,monospa=
ce">=C2=A0 Before I make final decisions on configuration, I wanted=C2=A0to=
 know if my understanding is correct and whether there is any documentation=
 on this that I&#39;ve somehow missed.</div><div class=3D"gmail_default" st=
yle=3D"font-family:monospace,monospace"><br></div><div class=3D"gmail_defau=
lt" style=3D"font-family:monospace,monospace">=C2=A0 FreeBSD is, of course,=
 the host of choice for this operation!</div><div class=3D"gmail_default" s=
tyle=3D"font-family:monospace,monospace"><br></div><div class=3D"gmail_defa=
ult" style=3D"font-family:monospace,monospace">=C2=A0 If anyone does know a=
ny details, any info would be greatly appreciated.</div><div class=3D"gmail=
_default" style=3D"font-family:monospace,monospace"><br></div><div class=3D=
"gmail_default" style=3D"font-family:monospace,monospace">Many Thanks,</div=
><div class=3D"gmail_default" style=3D"font-family:monospace,monospace">Rob=
 Ballantyne</div></div>
</blockquote></div>

--0000000000008aeee105efe55c4d--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAK-wPOhK1gX5%2BV1Z9nNauRF-oC85Jc-vmi-bKq_-YTKVt10C8Q>