Assigning a new IP Address with a linux guest

Discussions about using Linux guests in VirtualBox.
Post Reply
Gromz
Posts: 1
Joined: 8. Jun 2021, 11:25

Assigning a new IP Address with a linux guest

Post by Gromz »

Hello everyone

Sorry if this is a really dumb question but I am really new to networking.
I have a few different windows VMs connected to a Windows host, I have set a new NAT Network and one of my guests is a Linux RHEL8 machine.
My problem is that I do not know how to reassign the IP address in this guest as when I launch it, it gives the same IP address as one of my windows machines.

I did some reading and I did see that I need to use the ifconfig command although I do not know how to locate the local host machine name?

From what i can see is that i need to use something like this "$ ifconfig <interface_name> <ip_address> netmask <netmask_address>"

So i know how to locate everything except the <interface_name>

Many thanks in advance and please be gentle as this is my first post :)
mpack
Site Moderator
Posts: 39156
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Assigning a new IP Address with a linux guest

Post by mpack »

Gromz wrote:it gives the same IP address as one of my windows machines.
As seen using what tool? ifconfig running inside the guest certainly did not show it using the same IP address as your host, at least not unless you disabled DHCP and assigned that IP address statically.

A NAT VM communicates using the host Internet connection, so anything outside your host PC will see your host PC address.

This is exactly how NAT always works. E.g. most home routers use NAT, all PCs on your local network share a single IP address as seen by the outside world (outside your house).

Why do you care what IP address the VM is using?
fth0
Volunteer
Posts: 5661
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Assigning a new IP Address with a linux guest

Post by fth0 »

Gromz wrote:So i know how to locate everything except the <interface_name>
FWIW, using the ifconfig command without any arguments will show you the available interface names.
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Assigning a new IP Address with a linux guest

Post by scottgus1 »

Gromz wrote:new NAT Network...[Linux RHEL8 machine] gives the same IP address as one of my windows machines.
First, to confirm, is this "NAT Network" or just two VMs both using NAT? NAT and NAT Network are two closely-related but different network types. See Virtualbox Networks: In Pictures.

If both VMs are using just NAT, then they will both have the same IP address, 10.0.2.15 by default. If they're both connected to the same NAT Network may give the VMs different IP addresses if the NAT Network has its DHCP server enabled.

Diagnosing data to help figure this out would include the following:

For each VM that has the same IP address, the RHEL8 and the Windows, right-click the VM in the main Virtualbox window's VM list, choose Show in Explorer/Finder/File Manager. Zip the VM's .vbox file (not the .vbox-prev file), and post the zip file, using the forum's Upload Attachment tab. (Configure your host OS to show all extensions if the folder that opens does not show a .vbox file.)

For the RHEL8 VM, post the output of 'ifconfig' or 'ip address'.

For the Windows VM post the output of 'ipconfig /all'.

More things might be needed depending on what this data shows.
Post Reply