Understanding Virtual Machine IP Address ???? Basics? - linux

Host Machine is Windows 7
and I am using Oracle Virtual Box ( GUEST OS - FEDORA 20). I have enabled bridged connection in between host machine and guest machine. (Did it by selecting bridge connction inside virtual box manager)
Now I am a bit confused about IP addresses.
On my FEDORA guest machine when I do ifconfig. It shows me 2 interfaces. lo (localloop) and p2p1 with an IP address 192.168.0.12.
When I use firefox inside fedora is shows me some ip address which is same ip address as my host machine. (I checked using whats my ip address dot com)
Now I have a few questions
a) How come my guest OS and Host OS have same IP address ?
b) From where does interface p2p1 is getting an address 192.168.0.12 ? Is it assigned by my Wifi router ?
If yes, then is it possible to do ssh to 192.168.0.12 to reach my virtual machine from other machines connected to same router ? (provided if i enable ssh on my virtual machine)
c) Since it's an bridge network, How can I ssh or telnet my host windows machine from virtual machine ?

When I use firefox inside fedora is shows me some ip address which is same ip address as my host machine.
No. It shows the public IP address of your DSL router which is the same for your host and the virtual machine, as any traffic to the internet is going over the router. You need to understand that first.
When you have enabled "bridged connection" the vm is in the same private subnet as your host machine. The IP address 192.168.0.12 has been assigned by the local DHCP server, which is running on your router.
Since both, the vm and your host computer are in the same network you can ssh into your host computer from the vm using your host computer's IP address, which will be 192.168.0.???.

Related

How to access host files from VM oracle enterprise linux

How to access host files from VM Oracle enterprise linux 6.3 (Virtual box).
It is not connected to internet and it has only terminal.
I downloaded Winscp, but it needs hostname(i.e IPaddress of VM), as it is not connected to internet, IP is not available. Is there any other alternative solution to access host files.
Please let me know which networking type you used for RHEL 6.3.
If you used NAT, then add port forwarding rule (host port 22 and guest port 22). and use IP address 127.0.0.1
If you used host-only adapter the it will have private network IP address. Use that private IP address.
If you used bridged then it will have a public IP address.
Please refer my blog for further details:
ref: http://trainenv.blogspot.in/2016/03/virtual-networking.html

Bridged linux networking and virtualization

I have Linux host with libvirt/kvm virtualization, VMs needs the "real" static IP addresses, so I decided to setup bridged network. I make br0 on the host and in the VMs properties I set source device: Host device vnet0(Bridge 'br0').
For example, my br0 have ip 192.168.1.1 and one of the VM have 192.168.1.5
Everything works pretty well, but then I connect to the virtual machine, the client address detects as 192.168.1.1. Also, all the HTTP requests comes from 192.168.1.1.
Q: Is it my mistake, some sort of misconfiguration? How can VM get the real IPs of the clients?
Let me try to answer based on what i infer from your question:
Since you want to assign routable IP addresses to the VMs,
Option 1: Add the host physical ethernet interface to the vswitch (aka vswitch uplink). Further, for all the VM ethernet interface, assign IP address in the same subnet in which the physical ethernet interface's IP belongs. Alternatively, if DHCP server is running in the same broadcast domain (subnet), the VMs would get the IP from the DHCP server if the interfaces are configured to get IP via DHCP
Option 2: Create the vswitch and assign X.Y.Z.1 IP to the vswitch (br0). Also enable IP forwarding in the host. Now you can assign IPs from the same subnet to the VM ethernet interfaces. Alternatively, you can run DHCP (e.g. DNSmasq) on br0 and assign IPs to the VM interfaces
Is it my mistake, some sort of misconfiguration? How can VM get the real IPs of the clients?
If you are connecting from the host on which your vms are running, then they are getting the real IP address. Your host shares a network (192.168.1.0/24 or similar, apparently) with the virtual machines. When you connect to your virtual machines from your host, the source address if 192.168.1.1.
If you are connecting from elsewhere on your network, you would need to provide us with more details of your configuration.

Access webserver hosted in Parallels VM from any connected to the same network device

I need to access webserver (IIS) hosted in Windows Parallels VM from a device connected to the same wi-fi network as the host for VM.
So I have:
wifi mywifi with DHCP from 192.168.1 to 192.168.1.255
mac host - connected to mywifi with ip address 192.168.1.10
parallels VM - in bridged network mode via host's wifi adapter. Ip address is 192.168.1.12
device (mobile) - connected to mywifi. Ip address is 192.168.1.24
As a result my host can access the VM IIS using Ip address (192.168.1.12).
Unfortunately I'm unable to access the VM IIS from any other device (mobile device particularly with ip 192.168.1.24) which are connected to the same wifi network.
Please advise.

LAMPP website can't be viewed by other computers?

I have a VMware workstation which has Ubuntu in it and I've also installed LAMPP on it, I have already created a full running website using php. I could access the website on my local computer(where the vmware is installed) by using the ip address however if i try using other computers, I couldn't open the website. What am I missing?
One possible cause is that you probably have the VM interface card in NAT mode. If the interface is in NAT mode, your Ubuntu VM will be "hidden" behind the VM host.
Change the Virtual Machine network interface card to bridged mode, in Virtual Machine settings -> Network Adapter.
After setting the interface do Bridged mode, if you have a DHCP server on your network, you only have to renew the IP address of the Ubuntu machine (if it didn't do it automatically).
Check the new IP address of the Ubuntu machine (should be an IP address of your LAN). Use this IP to contact the web server.

SSH into Linux Guest Virtual machine from External Source?

I currently have a Linux server running as a guest on Virtualbox using Windows 8.1 as the host. I can SSH from my Windows host into the guest with no problem. But how do I set it up so I can SSH from an external machine that is not within the local network, like from another country, for example? All the examples I see online are SSHing from the host to the guest only.
My Linux guest is using a bridged network and using dynamic IP.
Thank you very much!
Ok, so I got it figured out!
I set up 2 networks in Virtualbox: NAT (eth0) and bridged (eth1). NAT allows for internet access from the Linux guest, and bridged allows the Windows host to send the data through to the Linux guest. Both are given dynamic IP in the Linux guest.
In the port forwarding section for NAT of Virtualbox, I have the interal IP address of the Windows host and the IP address of the bridged connection as guest. In my case, it's 192.168.1.1 and 192.168.1.8, respectively. Ports are 2222 and 22, respectively.
For my router, I enabled port forwarding to port 2222 of the Windows host (192.168.1.1).
In Windows Firewall, I opened up port 2222 for connections.
And that's it! I can now SSH to the Linux guest from computers in the local network via (username)#192.168.1.8, and via (username)#Windows_host_public_IP from a computer outside the local network.
I followed all the steps which you mentioned but still I am not able to connect from external network.
Steps I followed listed below.
Created NAT and Bridged connection on Linux vm.
Created NAT and Bridged connection on virtual box.
In NAT port forwarding table of virtual box, added host ip as windows ip and host port as 2222 along with guest ip as Linux vm Bridged ip and guest port as 22.
Opened port 2222 on windows firewall settings.
Please let me know if I missed something here.

Resources