Jump to content

How to assign static IP address to an Hyper-V guest(Ubuntu) with different range than my ISP?

 

Hello,

 

My goal is to set a static IP address for my Ubuntu VM in Hyper-V, with different range than the ISP one.

 

Currently the default switch assigns the guest VM IP addresses in the 172.25.x.x range which is what I want - different than my ISP range which is 192.168.x.x.

However, the IPs keep changing (after a reboot for example), and I want it static.

 

I am not sure how to do it because I found contradicting information. For example, I found that I cannot assign static IP address with the default switch: https://superuser.com/a/1761121/1615431

I then found that I can do it by setting the MAC address of the guest to static, and not even doing anything with the switch: https://superuser.com/a/1504633/1615431

 

 

Or maybe I need to do it from withing Ubuntu itself?

 

thanks!

Link to comment
Share on other sites

Link to post
Share on other sites

😮 It worked! 

 

Can you please help me understand why? Because it is completely different that what I even had in mind.

 

From this guide, it seems like I add 2 adapters to the VM? Both the default adapter, and a virtual internal switch?

 

Is it working like this: The default switch is acting as if it's a cable connecting to another managed switch, and this managed switch is the internal one I just created?

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×