Browse Source

new article on name resolution with podman and libvirt

pull/10/head
Nicolas Massé 5 years ago
parent
commit
c0f23640d3
  1. BIN
      content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/consistent-dns-resolution-in-vm-and-containers.png
  2. 373
      content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/dnsmasq-for-consistent-dns-resolution-vm-containers.src.svg
  3. 3
      content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/dnsmasq-for-consistent-dns-resolution-vm-containers.svg
  4. 241
      content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/index.md

BIN
content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/consistent-dns-resolution-in-vm-and-containers.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 KiB

373
content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/dnsmasq-for-consistent-dns-resolution-vm-containers.src.svg

@ -0,0 +1,373 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="600"
height="400"
viewBox="0 0 158.75 105.83334"
version="1.1"
id="svg5"
sodipodi:docname="dnsmasq-for-consistent-dns-resolution-vm-containers.src.svg"
inkscape:version="1.1 (c68e22c387, 2021-05-23)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview7"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:document-units="mm"
showgrid="false"
inkscape:zoom="1.5"
inkscape:cx="306.66667"
inkscape:cy="186.66667"
inkscape:window-width="1920"
inkscape:window-height="1127"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="layer1"
inkscape:snap-nodes="false"
units="px"
width="600px" />
<defs
id="defs2">
<marker
style="overflow:visible"
id="Arrow2Lstart"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow2Lstart"
inkscape:isstock="true">
<path
transform="matrix(1.1,0,0,1.1,1.1,0)"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
style="fill:context-stroke;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
id="path9614" />
</marker>
<marker
style="overflow:visible"
id="Arrow2Lstart-7"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow2Lstart"
inkscape:isstock="true">
<path
transform="matrix(1.1,0,0,1.1,1.1,0)"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
style="fill:context-stroke;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
id="path9614-6" />
</marker>
<marker
style="overflow:visible"
id="Arrow2Lstart-7-6"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow2Lstart"
inkscape:isstock="true">
<path
transform="matrix(1.1,0,0,1.1,1.1,0)"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
style="fill:context-stroke;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
id="path9614-6-9" />
</marker>
<marker
style="overflow:visible"
id="Arrow2Lstart-3"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow2Lstart"
inkscape:isstock="true">
<path
transform="matrix(1.1,0,0,1.1,1.1,0)"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
style="fill:context-stroke;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
id="path9614-7" />
</marker>
<marker
style="overflow:visible"
id="Arrow2Lstart-7-6-6"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow2Lstart"
inkscape:isstock="true">
<path
transform="matrix(1.1,0,0,1.1,1.1,0)"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
style="fill:context-stroke;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
id="path9614-6-9-8" />
</marker>
<marker
style="overflow:visible"
id="Arrow2Lstart-7-6-6-4"
refX="0"
refY="0"
orient="auto"
inkscape:stockid="Arrow2Lstart"
inkscape:isstock="true">
<path
transform="matrix(1.1,0,0,1.1,1.1,0)"
d="M 8.7185878,4.0337352 -2.2072895,0.01601326 8.7185884,-4.0017078 c -1.7454984,2.3720609 -1.7354408,5.6174519 -6e-7,8.035443 z"
style="fill:context-stroke;fill-rule:evenodd;stroke-width:0.625;stroke-linejoin:round"
id="path9614-6-9-8-9" />
</marker>
</defs>
<g
inkscape:label="Calque 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#84b8ff;fill-opacity:1;fill-rule:evenodd;stroke:#006cff;stroke-width:0.465;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
id="rect31"
width="50.765812"
height="23.584118"
x="53.948433"
y="26.804808" />
<rect
style="fill:#84b8ff;fill-opacity:1;fill-rule:evenodd;stroke:#006cff;stroke-width:0.465;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
id="rect31-1"
width="50.765812"
height="23.584118"
x="5.3811669"
y="76.171562" />
<rect
style="fill:#84b8ff;fill-opacity:1;fill-rule:evenodd;stroke:#006cff;stroke-width:0.465;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
id="rect31-1-5"
width="50.765812"
height="23.584118"
x="102.85838"
y="76.171562" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93889px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="112.9809"
y="89.326157"
id="text5330"><tspan
sodipodi:role="line"
id="tspan5328"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93889px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="112.9809"
y="89.326157">*.dns.podman</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93889px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="18.412006"
y="89.804855"
id="text6840"><tspan
sodipodi:role="line"
id="tspan6838"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93889px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="18.412006"
y="89.804855">*.dns.libvirt</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93889px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="68.719238"
y="40.438099"
id="text7834"><tspan
sodipodi:role="line"
id="tspan7832"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.93889px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="68.719238"
y="40.438099">*.dns.host</tspan></text>
<path
style="fill:none;stroke:#000000;stroke-width:0.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Lstart)"
d="M 39.558137,73.973047 63.541986,52.787312"
id="path9377" />
<path
style="fill:none;stroke:#000000;stroke-width:0.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Lstart-7)"
d="M 57.019036,53.07979 33.035187,74.265525"
id="path9377-5" />
<path
style="fill:none;stroke:#000000;stroke-width:0.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Lstart-3)"
d="M 120.05837,73.987965 96.074544,52.80223"
id="path9377-4" />
<path
style="fill:none;stroke:#000000;stroke-width:0.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Lstart-7-6)"
d="m 102.59747,53.07979 23.98385,21.185735"
id="path9377-5-5" />
<path
style="fill:none;stroke:#000000;stroke-width:0.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Lstart-7-6-6)"
d="m 83.791653,7.4270025 0.0857,17.2607395"
id="path9377-5-5-8"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#000000;stroke-width:0.3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;marker-start:url(#Arrow2Lstart-7-6-6-4)"
d="m 79.889648,24.145536 0.0857,-17.2607392"
id="path9377-5-5-8-2"
sodipodi:nodetypes="cc" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="-6.0716043"
y="87.005356"
id="text20953"
transform="rotate(-39.71421)"><tspan
sodipodi:role="line"
id="tspan20951"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="-6.0716043"
y="87.005356">requests for</tspan><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="-6.0716043"
y="91.415077"
id="tspan27051">*.dns.libvirt</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="105.53634"
y="-17.946995"
id="text20953-4"
transform="rotate(40.664027)"><tspan
sodipodi:role="line"
id="tspan20951-4"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="105.53634"
y="-17.946995">requests for</tspan><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="105.53634"
y="-13.53727"
id="tspan27051-3">*.dns.podman</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="27.678135"
y="14.898643"
id="text20953-4-0"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="27.678135"
y="14.898643"
id="tspan27051-3-8">requests for *.dns.podman,</tspan><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="27.678135"
y="19.308367"
id="tspan63343">*.dns.host and *.dns.libvirt</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="-24.859264"
y="71.764229"
id="text20953-5"
transform="rotate(-39.71421)"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="-24.859264"
y="71.764229"
id="tspan27051-7">requests for everything</tspan><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;stroke-width:0.264583"
x="-24.859264"
y="75.292007"
id="tspan45326">unknown locally</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;direction:rtl;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="146.25264"
y="-36.792606"
id="text20953-5-0"
transform="rotate(42.739427)"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;direction:rtl;stroke-width:0.264583"
x="146.25264"
y="-36.792606"
id="tspan27051-7-7">requests for everything</tspan><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.82222px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;direction:rtl;stroke-width:0.264583"
x="146.25264"
y="-33.264832"
id="tspan45326-8">unknown locally</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;direction:ltr;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="87.613541"
y="15.115078"
id="text20953-5-0-4"
transform="rotate(-0.15842498)"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;direction:ltr;stroke-width:0.264583"
x="87.613541"
y="15.115078"
id="tspan27051-7-7-3">requests for everything</tspan><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:3.52778px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;direction:ltr;stroke-width:0.264583"
x="87.613541"
y="19.524801"
id="tspan45326-8-1">unknown locally</tspan></text>
<rect
style="fill:#006cff;fill-opacity:1;stroke:#006cff;stroke-width:0.500802;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect67600"
width="5.5029025"
height="23.03334"
x="54.186821"
y="27.043196" />
<rect
style="fill:#006cff;fill-opacity:1;stroke:#006cff;stroke-width:0.346359;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect67600-9"
width="2.6146367"
height="23.187782"
x="5.6379972"
y="76.380058" />
<rect
style="fill:#006cff;fill-opacity:1;stroke:#006cff;stroke-width:0.346359;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="rect67600-9-4"
width="2.6146367"
height="23.187782"
x="103.11495"
y="76.33596" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11667px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="-49.952526"
y="56.147484"
id="text71037"
transform="rotate(-90)"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11667px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ffffff;fill-opacity:1;stroke-width:0.264583"
x="-49.952526"
y="56.147484"
id="tspan75501">Managed by</tspan><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11667px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ffffff;fill-opacity:1;stroke-width:0.264583"
x="-49.952526"
y="58.79332"
id="tspan83941">NetworkManager</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11667px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="-99.516945"
y="7.5072064"
id="text71037-2"
transform="rotate(-90)"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11667px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ffffff;fill-opacity:1;stroke-width:0.264583"
x="-99.516945"
y="7.5072064"
id="tspan83941-6">Managed by libvirt</tspan></text>
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11667px;line-height:1.25;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.264583"
x="-99.516945"
y="104.96206"
id="text71037-2-9"
transform="rotate(-90)"><tspan
sodipodi:role="line"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:2.11667px;font-family:sans-serif;-inkscape-font-specification:'sans-serif, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ffffff;fill-opacity:1;stroke-width:0.264583"
x="-99.516945"
y="104.96206"
id="tspan83941-6-5">Managed by podman</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 22 KiB

3
content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/dnsmasq-for-consistent-dns-resolution-vm-containers.svg

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 9.6 KiB

241
content/english/blog/consistent-dns-name-resolution-for-virtual-machines-and-containers/index.md

@ -0,0 +1,241 @@
---
title: "Consistent DNS name resolution for virtual machines and containers"
date: 2021-06-09T00:00:00+02:00
opensource:
- Podman
- libvirt
---
When developing on microservices, developers need to run a mix of software.
Some of them running in containers, others in virtual machines, some others in the cloud and the rest on the developer's workstation.
Microservices having a lot of connections between themselves in addition to technologies such as TLS or OpenID Connect implies DNS names to be consistent.
Consistent DNS names means that no matter if a client on the developer workstation, on a VM or on a container, trying to reach a server on the developer workstation, on a VM or on a container, the server DNS name must always be the same.
This article explains how to setup a developer workstation on Fedora, with Libvirt VMs and Podman containers and achieve consistent DNS name resolution.
<!--more-->
## Context
Microservices have a lot more connections between themselves than a monolithic application.
In a classical three tier architecture, the presentation tier talks to the application tier that in turns talks to the data tier.
With microservices, one can talk to several other services and those services can in turn call other services or even call back the originating microservice.
Now, add in the mix two technologies: TLS and OpenID Connect.
OpenID Connect is used to authenticate users and implies three components:
- the Authorization Server (usually running in VM or container)
- the Resource Server (usually running on the developer's workstation or in a VM or container)
- the developer's browser
And because there is a set of HTTP redirections and server-to-server connections at play in the OpenID Connect protocol, you need to have consistent DNS names between the host, the VMs and the containers.
TLS is used to secure connections between microservices and can optionally authenticate the calling microservice (mutual TLS).
Because the TLS protocol mandates the server name to be explicitly listed in the server certificate, it is easier when you have consistent DNS names.
Disabling TLS server certificate validation to get around inconsistent naming implies a different procedure for each programming language, which is far from practical.
## One dnsmasq to rule them all!
On fedora, virtual machines created with libvirt and containers created with Podman have their DNS served by separate dnsmasq instances.
By default, the host (the developer's workstation) is not configured to query those dnsmasq instance.
Hence, if you try to query your container by its DNS name from your host, it will fail.
By configuring a third dnsmasq instance to gather the libvirt and podman ones, we achieve consistent DNS name resolution.
The beauty of this setup is that you do not have to maintain this third dnsmasq instance since there is one provided with NetworkManager, and we will re-use it!
{{< attachedFigure src="dnsmasq-for-consistent-dns-resolution-vm-containers.svg" title="Three dnsmasq instances to get consistent DNS name resolution between VMs, containers and the host." >}}
## Configure Podman
By default, Podman does not assign DNS names to containers.
You can change this by editing the default podman network named **podman**.
Edit **/etc/cni/net.d/87-podman-bridge.conflist** and add the **dnsname** plugin in the **plugins** array.
The complete file should look like this:
```json
{
"cniVersion": "0.4.0",
"name": "podman",
"plugins": [
{
"type": "bridge",
"bridge": "cni-podman0",
"isGateway": true,
"ipMasq": true,
"hairpinMode": true,
"ipam": {
"type": "host-local",
"routes": [{ "dst": "0.0.0.0/0" }],
"ranges": [
[
{
"subnet": "10.88.0.0/16",
"gateway": "10.88.0.1"
}
]
]
}
},
{
"type": "portmap",
"capabilities": {
"portMappings": true
}
},
{
"type": "firewall"
},
{
"type": "tuning"
},
{
"type": "dnsname",
"domainName": "dns.podman",
"capabilities": {
"aliases": true
}
}
]
}
```
## Configure Libvirt
The default libvirt network configuration is pretty good since DNS is enabled by default.
In this section, I'm proposing to slightly adjust it to explicitly define the DNS zone (**dns.libvirt**).
This also prevents the infamous 5 seconds timeout on IPv6 DNS queries.
Create a file **/tmp/default-net.xml** that contains the following libvirt network definition.
{{< highlightFile "/tmp/default-net.xml" "xml" "" >}}
<network xmlns:dnsmasq="http://libvirt.org/schemas/network/dnsmasq/1.0">
<name>default</name>
<forward mode='nat'>
<nat>
<port start='1024' end='65535'/>
</nat>
</forward>
<bridge name='virbr0' stp='on' delay='0'/>
<ip address='192.168.122.1' netmask='255.255.255.0'>
<dhcp>
<range start='192.168.122.2' end='192.168.122.254'/>
</dhcp>
</ip>
<dnsmasq:options>
<dnsmasq:option value="auth-server=dns.libvirt,"/><!-- yes, there is a trailing coma -->
<dnsmasq:option value="auth-zone=dns.libvirt"/>
</dnsmasq:options>
</network>
{{< /highlightFile >}}
Replace the default libvirt network.
```sh
sudo virsh net-undefine default
sudo virsh net-define /tmp/default-net.xml
sudo virsh net-start default
sudo virsh net-autostart default
```
## Configure NetworkManager
Fedora uses by default systemd-resolved for DNS name resolution.
In this section, we will configure NetworkManager to replace systemd-resolved with dnsmasq.
We will also configure the dnsmasq instance bundled with NetworkManager.
Edit **/etc/NetworkManager/NetworkManager.conf** and set the **dns** directive in the **main** section.
```ini
[main]
dns=dnsmasq
```
Delete the **/etc/resolv.conf** symbolic link created by systemd-resolved and replace it by an empty file.
```sh
sudo rm /etc/resolv.conf
sudo touch /etc/resolv.conf
```
Restart NetworkManager.
```sh
sudo systemctl restart NetworkManager
```
At this point, your **/etc/resolv.conf** should contain the following content:
```sh
# Generated by NetworkManager
search itix.fr
nameserver 127.0.0.1
options edns0 trust-ad
```
Create the dnsmasq configuration file to dispatch requests to **dns.podman**, **dns.libvirt** and **dns.host**.
{{< highlightFile "/etc/NetworkManager/dnsmasq.d/podman-libvirt-dns.conf" "ini" "" >}}
server=/dns.podman/10.88.0.1
server=/dns.libvirt/192.168.122.1
host-record=host.dns.host,192.168.122.1
{{< /highlightFile >}}
Restart the dnsmasq instance of NetworkManager.
```sh
sudo pkill -f '[d]nsmasq.*--enable-dbus=org.freedesktop.NetworkManager.dnsmasq'
```
## End-to-end test
Now that everything is configured, we will install a container, a VM and make sure we can resolve the IP address of all of them from all of them.
Start a fedora container.
```sh
sudo podman run -it --name fedora --rm registry.fedoraproject.org/fedora:latest
```
Install Fedora in a virtual machine.
```sh
sudo curl -Lo /var/lib/libvirt/images/fedora-cloud.qcow2 https://download.fedoraproject.org/pub/fedora/linux/releases/34/Cloud/x86_64/images/Fedora-Cloud-Base-34-1.2.x86_64.qcow2
sudo virt-install --name fedora --memory 3074 --cpu host --vcpus 2 --graphics none --os-type linux --os-variant fedora33 --import --disk path=/var/lib/libvirt/images/fedora.qcow2,backing_store=/var/lib/libvirt/images/fedora-cloud.qcow2,format=qcow2,bus=virtio --network network=default --cloud-init
```
Write down the root password that is auto-generated for you and login as root once the VM has started.
If at any time you need to close the VM console, use `Ctrl+AltGr+]`.
Set the hostname of the Fedora virtual machine and renew its DHCP lease.
```sh
hostnamectl set-hostname fedora.dns.libvirt
ifdown eth0
ifup eth0
```
Install dig on your workstation, in the virtual machine and in the container.
```sh
dnf install -y bind-utils
```
From your host, the container and the virtual machine, run those commands and make sure they all return the correct IP address.
```sh
dig +short host.dns.host
dig +short fedora.dns.podman
dig +short fedora.dns.libvirt
dig +short www.google.fr
```
If your configuration is correct, you should get the following result. The top left terminal is the container, the bottom left terminal is the virtual machine and the right terminal is the host.
{{< attachedFigure src="consistent-dns-resolution-in-vm-and-containers.png" title="Consistent DNS name resolution between VMs, containers and the host." >}}
Congratulations! You just configured a consistent DNS name resolution between VMs, containers and the host.
Loading…
Cancel
Save