{"id":1893,"date":"2022-10-09T00:04:11","date_gmt":"2022-10-09T00:04:11","guid":{"rendered":"https:\/\/www.qworqs.com\/?p=1893"},"modified":"2022-10-09T00:07:36","modified_gmt":"2022-10-09T00:07:36","slug":"static-ip-on-hyper-v-debian-guests","status":"publish","type":"post","link":"https:\/\/www.voodoo.business\/blog\/2022\/10\/09\/static-ip-on-hyper-v-debian-guests\/","title":{"rendered":"Static IP on Hyper-v (Debian Guests)"},"content":{"rendered":"\n<p>One problem i face when developing using Hyper-v is that I need static addresses, and the default switch keeps changing the ip range<\/p>\n\n\n\n<p>The simplest solution to this is to create a new switch of type <strong>internal<\/strong> ! this only connects the virtual machines to each other (Static IP etc\u2026), and can not access the internet<\/p>\n\n\n\n<p>Right after creating an INTERNAL switch in the switch manager, you go to &#8220;Manage network adapter settings&#8221; on the host computer, and assign an IP such as 10.10.20.1 to the adapter and a subnet of 255.255.255.0, no gateway, and nothing but those IPs.<\/p>\n\n\n\n<p>Once that is done, you add a second adapter to all the virtual machines, and in the \/etc\/network\/interfaces file, you leave eth0 the way it was (For internet) and add a metric 10 under the last line for eth0, then  add the following stanza for the new adapter (Assuming eth1), eth 1 has a higher cost in it&#8217;s metric, so unless the remote is on the eth1 subnet, it will go through the eth0<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">auto eth1\niface eth1 inet static\n address 10.10.20.41\/24\n metric 100<\/pre>\n\n\n\n<p>And you are done, those virtual machines can address each other with their 10.10.20.x addresses, and access the outside world via the other network interface.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>One problem i face when developing using Hyper-v is that I need static addresses, and the default switch keeps changing the ip range The simplest solution to this is to create a new switch of type internal ! this only connects the virtual machines to each other (Static IP etc\u2026), and can not access the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[157,4,117,17],"tags":[],"class_list":["post-1893","post","type-post","status-publish","format-standard","hentry","category-hyper-v","category-linux","category-virtualization","category-windows"],"_links":{"self":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/1893","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/comments?post=1893"}],"version-history":[{"count":5,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/1893\/revisions"}],"predecessor-version":[{"id":1899,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/posts\/1893\/revisions\/1899"}],"wp:attachment":[{"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/media?parent=1893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/categories?post=1893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.voodoo.business\/blog\/wp-json\/wp\/v2\/tags?post=1893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}