<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Networking on .NET wat we zoeken</title><link>https://blog.netwatwezoeken.nl/tags/networking/</link><description>Recent content in Networking on .NET wat we zoeken</description><generator>Hugo</generator><language>en</language><lastBuildDate>Tue, 18 Feb 2020 12:45:04 +0200</lastBuildDate><atom:link href="https://blog.netwatwezoeken.nl/tags/networking/index.xml" rel="self" type="application/rss+xml"/><item><title>Static IPs with NAT on Hyper-V</title><link>https://blog.netwatwezoeken.nl/posts/static-ip-for-hyper-v-with-nat/</link><pubDate>Tue, 18 Feb 2020 12:45:04 +0200</pubDate><guid>https://blog.netwatwezoeken.nl/posts/static-ip-for-hyper-v-with-nat/</guid><description>&lt;p&gt;The goal is to have networking with static ip addresses for virtual machines on Hyper-V. The machine must also be able to access the internet.
The easiest way is to start a Powershell session with elevated rights. Then use the follwing three commands. Feel free to change any names and ip address ranges.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Create a new switch&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;New-VMSwitch&lt;/span&gt; &lt;span class="n"&gt;-SwitchName&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;NAT Switch 192.168.40.x&amp;#34;&lt;/span&gt; &lt;span class="n"&gt;-SwitchType&lt;/span&gt; &lt;span class="n"&gt;Internal&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="2"&gt;
&lt;li&gt;Assign and IP address&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;New-NetIPAddress&lt;/span&gt; &lt;span class="n"&gt;-IPAddress&lt;/span&gt; &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;40&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;1&lt;/span&gt; &lt;span class="n"&gt;-PrefixLength&lt;/span&gt; &lt;span class="mf"&gt;24&lt;/span&gt; &lt;span class="n"&gt;-InterfaceAlias&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;vEthernet (NAT Switch 192.168.40.x)&amp;#34;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;ol start="3"&gt;
&lt;li&gt;Enable NAT&lt;/li&gt;
&lt;/ol&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="nb"&gt;New-NetNAT&lt;/span&gt; &lt;span class="n"&gt;-Name&lt;/span&gt; &lt;span class="s2"&gt;&amp;#34;NATNetwork&amp;#34;&lt;/span&gt; &lt;span class="n"&gt;-InternalIPInterfaceAddressPrefix&lt;/span&gt; &lt;span class="mf"&gt;192.168&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="py"&gt;40&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="mf"&gt;0&lt;/span&gt;&lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="mf"&gt;24&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;This will result in:&lt;/p&gt;</description></item></channel></rss>