Setting Up a Fixed IP Address for Multipass Instances - dialloi659/multipass GitHub Wiki
In this tutorial, I'll show you how to quickly configure a fixed IP address for your Multipass instances. Whether you want to assign a fixed IP to an existing instance or configure it during the creation of a new instance, I've got you covered!
Before we begin, ensure that you have Multipass installed on your system. You can follow the official Multipass documentation for installation instructions.
To assign a fixed IP address to an existing Multipass instance, follow these steps:
-
List the running instances using the command
multipass list
. Make a note of the instance name for which you want to configure a fixed IP. -
Stop the Multipass instance with the command
multipass stop <instance_name>
, replacing<instance_name>
with the name of your instance. -
Check if a fixed IP address is already configured for the instance using the command
multipass info <instance_name>
. Note the currently assigned IP address. -
To assign a fixed IP address, run the following command:
multipass set <instance_name> static.eth0=<ip_address>/<subnet_mask>
Replace
<instance_name>
with the name of your instance, and<ip_address>
and<subnet_mask>
with the desired IP address and subnet mask. -
Start the Multipass instance again with the command
multipass start <instance_name>
.
After following these steps, your Multipass instance should have a fixed IP address assigned to the eth0
interface. You can verify the details of the instance using the command multipass info <instance_name>
to ensure that the IP address has been correctly configured.
If you want to configure a fixed IP address during the creation of a new Multipass instance, follow these steps:
Before creating the instance, let's confirm the available network connections by running the following command:
multipass networks
Make a note of the network you want to use for the instance. In this example, we'll use the network named "WiFi" with a manual mode.
To create the instance, run the following command:
multipass launch -n docker-lab-1 -m 3G -c 2 -d 10G --network name=WiFi,mode=manual
This command creates a new instance named "docker-lab-1" with the following specifications:
-
-n docker-lab-1
: Assigns the name "docker-lab-1" to the instance. You can choose any name you prefer. -
-m 3G
: Allocates 3GB of memory to the instance. Adjust the value based on your requirements. -
-c 2
: Configures the instance with 2 CPU cores. Modify the number as needed. -
-d 10G
: Sets the disk size for the instance to 10GB. Modify it according to your needs. -
--network name=WiFi,mode=manual
: Connects the instance to the "WiFi" network with manual mode. Replace "WiFi" with the name of your desired network.
After executing this command, Multipass will create the instance with the specified parameters. You can choose different values for memory, CPU cores, disk size, and network configuration based on your requirements.
By following these steps, you can either assign a fixed IP address to an existing Multipass instance or configure it during the creation of a new instance. Enjoy your fixed IP address-enabled Multipass instances!
Remember to adjust the commands and configurations according to your specific needs and network environment.