How can I communicate a guest VM to Host using Host-Only Adapter? (Virtual Box) - virtual-machine

I'm trying to make a connection from a guest virtual machine (VM) to host. I can from host to the guest VM, but not viceversa.
The context:
I'm trying to gain root access on a CTF VM from VulnHub.com, and I configured the guest VM (the CTF VM) network to Host-Only. Instead, if I choose Bridged Adapter, it works normally, but it means the VM is connected "directly" to my physical network adapter, and I want to avoid that for security reasons.
Some other thing I read is set 2 adapter: NAT and Host-Only, but it gives me only the NAT ip address range (10.0.x.x).
Basically, I want to use netcat to make a connection sending a reverse shell from the guest VM to the host, but I want to make it work with the Host-Only Adapter, not Bridged Adapter. How can I make it work?

I found the problem. It was I xd
Why? Because I was trying to access from the host-only adapter (named vboxnet0 in my machine) to the psysical adapter (a switch router). The host-only is a configuration which isolates the networking between the host machine and the guest virtual machine.
So, the IP (IPv4 address) to communicate from guest to host was specified when I created vboxnet0 on Host Network Manager (VirtualBox 6.1). And IS NOT the one I found using the command ifconfig in Linux.
I hope this can help another newbie who have this misunderstanding.
(Pro-Tip: Learn more about networking)

Related

Trying to connect to the pfsence web interface

I have installed and set up pfsence on virtual box and it is booting up properly and seems to be working fine. My problems are:
When I tried to ping the LAN IP from my computer's command prompt it does not receive the packets but if i ping it from inside the virtual machine using pfsence then it returns packets.
Also if I try the IP in the browser it does not take me to the pfsence interface. I used all defaults when installing the the pfsence.
Any suggestions will be welcomed
LAN IP - 192.168.20.20
pfsence version - 2.4.5
This means that you are unable to route into the VM from your computer. What is the Network Adapter for your VM attached to in your VirtualBox settings? If you configure it with a NAT you can achieve your desired configuration.
https://www.virtualbox.org/manual/ch06.html#network_nat

SQL Server - How connect to Guest SQL server on Virtual Box from Host via SSMS

I want to connect to SQL server on VirtualBox VM from Host machine via SSMS and .NET code. Details are as follows
Host: Window 10 Professional
Virtual Box Ver.:5.2.8 r121009 (Qt5.6.2)
Guest: Window 7 Professional(Firewall down)
Network:
Host:Asus Router- DHCP
Guest: Currently on NAT
Each time i try to connect from Host, it fails.
SQL Configuration is as follows,
Services
Protocol
TCPIP Properties
Please help.
thank you
Dheeraj Kumar
I solved it, do below steps
Go to Virtual Box application on Host machine
Now go to settings for Virtual machine
Change Attached To: Bridged Adapter
Now this step is tricky, you may need to choose/try different option here,
select one try to run VM and see if it gets the IP address, if not choose
another and try again
Once VM gets IP, you can connect it from Host

Setting static IP address in Hana Express Edition

I have installed at work SAP Hana Express Edition 2.0 in my laptop. It runs on VMware/Suse. I also set up a static IP address so I don't have to change the client connections. This works fine when I'm at work.
I added the following to hosts file:
192.168.1.85 hxehost
Problem is that when I take my laptop somewhere else all my client connections time out. I checked the IP address in Suse and it's the one I assigned. How to fix this problem?
If I disconnect the laptop from the Internet, I get the following error:
JDBC: Cannot connect to jdbc:sap://192.168.1.85:39013/ [Cannot connect to
host 192.168.1.85:39013 [No route to host: connect],
This is my setup:
How you connect to the virtual machine's IP ports depends on the setup chosen for the VM networking.
The address 192.168.1.85 is part of the 192.168.1.x network, which is very popular for home-router setup and small LANs. It's very likely that your laptop is part of such a network, when not at work. So when you ping the address the laptop uses the network interface that is linked to this network (e.g. your wifi adapter) to look for the host with IP 192.168.1.85. Whoever host currently got the 85 in your network, it's likely not your virtual machine.
One easy way to avoid this is to setup the virtual machine with host-only network. For that you have to configure the network adapter in VMware (or whatever hypervisor you use) to use the host-only network and assign an IP address in a different subnet e.g. in 192.168.5.x. For the HANA client software on your computer, the address to use would, of course, be 192.168.5.85 but it would be stable across all networks your laptop may log into.

Connecting to ubuntu home server without internet connection

I am running an Ubuntu server with my laptop through an Orcale VirtualBox and I try to maximize the bandwidth of my home server, as it really slows down my internet connection. My router supports up to 300Mbit upload/download speed and my laptop wifi's card up to 150bit.
I configured my server with the following(static IP, configured by vim /etc/network/interfaces):
auto eth0
iface eth0 inet static
address 192.168.1.240
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
192.168.1.1 is my default gateway, and I just configured a static IP which ends with 240.
When my laptop's WIFI is on, I can easily access the server's files(.html files etc) through chrome from any computer on my house, as I just need to enter the server's IP into the browser, plus I can access the server through SSH. But when It's off, I can't even access the server's HTML files through the laptop itself, though I can see that the server is still running on VirtualBox. When I turn the WIFI once again, I can run services which require Apache2 but they really slow my internet connection, as a result I can barely surf the web. I am trying to configure the server to use only the bandwidth of my router, since my actual internet connection is 30 Mbit download and 1.90 Mbit upload(according to speedtest), and It probably interferes with it. Is it possible to access the server without WIFI connection, so it will purely use my router's speed?
Any help would be appreciated.
1) Looks like you using bridged networking in VM config. When your network adapter is connected to real network - you can interact with your VM via network bridge. When it's not connected - your bridge is also closed. If you need to interact with your VM without WiFi connection - you can add one more virtual network adapter to you VM config: use "Host-only" adapter and configure it on both VM and host PC. Your VM will use new host-only adapter to interact with your PC, and old bridged adapter to interact with other network.
2) Check your WiFi speed near the router. Maybe it's too far or provides too weak signal.
PS. Sorry for my poor english.

KVM VM dhcp while configured a static IP in XML

I'm trying to workaround a DHCP issue by configuring my guest VM to use DHCP (to avoid having to configure it manually with a static IP) but defining a static IP in the XML.
This would enable setting an IP upon creation while not requiring configuring the virtual machines operating system to a static IP (making it sort of "independent").
I should point out:
Guests are Windows/Linux mixed
Must use a bridge setup (not NAT)
Is this a reasonable solution? any recommendations to the actual XML markup of the guest?
When saying static ip configuration instead of DHCP, it's not a libvirt thing but a configuration of guest OS. refer to this maillist for example.
So you can make it via a custom DHCP server that listens on your bridge network instead of default NAT. it only assigns specific ips to specific mac addresses. It's very easy to make it via dnsmasq.
If you do want to exclude any DHCP broadcast in your bridge network, think about bootstrap processes inside your guest OS. The config drive is a good choice where it allows you creating a disk file and attach to the VM, then the cloud-init daemon on guest OS will pick it up to replace network configuration. But it's just too many if you just want static ips.