QEMU on macOS big sur: connect to guest from the host without port forwarding - qemu

I'm having a hard time finding a solution to access my Linux guest system running on QEMU from my macOS Big Sur host.
The only solution I've found that works is port forwarding (using e.g. -net user,hostfwd=tcp::2200-:22 for SSH). This works, but is not convenient since I need to forward all the ports I need to use, and I would like to be able to use scripts, applications, etc. without having to tweak the ports everywhere.
So having an IP to connect from the host to the guest would be best, but surprisingly I couldn't find an easy to do so.

I was trying to achieve a similar setup and the approved answer was a big help.
By using QEMU 7.1+ you can make use of Appleā€™s VMNET framework for networking with VMs without port forwarding.
QEMU makes use of this with -netdev vmnet-shared / vmnet-bridged / vmnet-host
More detail can be found on the man page man qemu-system-aarch64
I have a short summary here: https://gist.github.com/max-i-mil/f44e8e6f2416d88055fc2d0f36c6173b

The only articles I found online related to this seem to be valid only for older versions of macOS.
Looks like newer versions of macOS have a new mechanism for this, called vmnet.
And a patch for QEMU was implemented recently: https://gitlab.com/qemu-project/qemu/-/issues/465
With this patch, using -nic vmnet-host makes the guest accessible from the host (on an interface called bridge100).
At the moment, the latest stable release of QEMU (7.0.0) doesn't include this patch, but it's possible with brew to build the latest HEAD from git, which includes this change (but can't be considered stable!), using brew install qemu --HEAD.
Afterwards, make sure to use the correct qemu binary, by updating your PATH env variable or executing the binary with full path directly. Should be something like this: /usr/local/Cellar/qemu/HEAD-7077fcb/bin/

socket_vmnet might solve your problem
https://github.com/lima-vm/socket_vmnet
As Lima claims
The guest IP is assigned by the DHCP server provided by macOS. The guest is accessible to the internet, and the guest IP is accessible from the host.

Related

Encountered problem while integrating devstack - osm (open source mano)

I'm currently trying to develop a cloud in my pc using virtual box. The idea is that I have 2 virtual machines, one which devstack installed (all in one) and the other with osm mano. Right now both have everything installed. Hence, I can log in to mano via user and password 'admin' as well as to devstack.
Current properties:
VM1 (devstack): IP (enp0s8) -> 192.168.56.101
Login to 192.168.56.101 -> correct
VM2 (mano): IP (enp0s8) -> 192.168.56.105
Login to 192.168.56.105 -> correct
As some of you may guess, I have 2 network interfaces in every vm, the first one being NAT (enp0s3 with 10.0.2.15 IP) and the second one being Host Only (192.168.56.x according to virtual box).
Needless to say, I can ping from one virtual machine to another without any problem.
Now, in the past I've being using devstack (ubuntu 18.04) in order to play with it a little bit, learn how to deploy instances, create groups and so on. Indeed, I developed a topology with an instance as a router and nagios as the monitoring tool system. It worked and I learnt a lot!
Anyway, what I want in this case is starting from scratch (scratch meaning having downloaded mano and devstack but without going further). So here I am, trying to integrate OSM with Devstack, making use of osm-vim command as it is:
osm vim-create --name openstack-site --user admin --password my_openstack_password --auth_url http://192.168.56.101:5000/v3 --tenant admin --account_type openstack
In this case, my openrc file (downloaded from horizon) resulted in my auth_url being:
export OS_AUTH_URL=http://192.168.56.101:5000/v3
What I'm trying to get my head into is how it's possible that this doesn't work, as whenever I log-in to mano web interface (after osm-vim command) I go to VIM accounts and operational state equals to "error".
Any kind of help would be much appreciated, as I've being struggling for a week now.
Thanks in advance!
I had the same problem. At the beginning I thought It was a network problem, but finally I found out It was due to a SSL problem. The most easy solution is to put a specific flag to avoid the SSL verification until the developers fix it. "--config '{insecure: True}'"
I also encountered this problem when I finished installing OSM-10 and OpenStack-Ussuri for Ubuntu18.04 some days ago. I solved this problem by change the url "--auth_url http//:192.168.23.18:5000/v3" to "-- auth_url http//:controller:5000/v3" and put "192.168.23.18 controller" in the ro container "/etc/hosts". The "controller" here is the host name where you install your openstack and which is used is your keystone authentication urls. Maybe you also have solved this problem but this problem is so troublesome and I hope more people do not be annoyed at this~

MacOS MySQL Gone Away and local networking issues due to GateKeeper

On MacOS Mojave 10.14.5, local services relying on TCP connections have connections randomly aborted, resulting in errors like "Mysql has gone away" and Nginx connection resets.
Seems like the Mojave OS is monitoring and blocking TCP connections, even if the firewall is disabled.
I managed to get MySQL working in a docker image, however this is much slower than native MySQL service. Same applies to NGinx.
A lot of blog articles online cover this issue with MySQL, recommending to increase wait_timeout and max_packet_size, which does not work in this case as the issue is most likely not with MySQL itself (in fact, local Nginx seems also to be affected).
Just spent 2.7K on a brand new MacBookPro and feel like I can't work with it...
Any help?
Chatted with Apple Support, who recommended to do an SMC reset, which I have done twice and it did not help... They don't really offer support for the OS issues... Was about to return the MacBookPro and buy a Linux laptop...
... and then figured it out!!!
As part of installation instructions for a third-party VPN software, I have been asked to run the following command on my MacOS Mojave 10.14.5:
sudo spctl --master-disable
This was to allow ALL applications to be installed on the system, bypassing System > Privacy settings (adding a third option "Allow all"), basically working around the GateKeeper service to allow for the VPN app to install.
This was meant to be disabling GateKeeper, so it won't interfere with the application, however it looks like GateKeeper is still doing something shady, and actually causing the networking issues.
Anyway, it was enough to switch it back and restart the MacBook:
sudo spctl --master-enable
in Terminal and reboot.

KVM/QEMU No bootable device 0003 error and solution

I am new to kvm, so maybe a lot of you will take it silly, but I would like to describe the problem I had.
When I was typing
kvm
in qemu the error of 'no bootable device' with code 0003 occurs.
This is because your command line is (implicitly) asking to create a virtual machine with no disk. The guest BIOS then looks for disks or CDROMs that it can boot from, and finds none. This is exactly the same behaviour as if you had a real hardware PC, and powered it up with no disks in it.
In general, the QEMU command line can be long and complicated, especially if you want best performance from the virtual machine. For most users it's often best to use a "management layer" program like libvirt, which takes care of these details for you, rather than trying to run QEMU directly.
The easiest fix, which let me open the virtual machine through terminal was just to find it:
sudo find /var/lib/libvirt/images/
Choose the correct one and copy/paste the path to the code:
sudo kvm /var/lib/libvirt/images/Centos.qcow2
And thats it..
I couldn't find it in manual to qemu or kvm, but it is that easy, the hours of config changes and bus types were not necessary.

Google Chrome remote debugging local domain

I'm developing a website on my local machine using myblog.local as a custom domain for that, I have an apache VirtualHost and the name registered on the hosts file of my mac. The thing is when I try to use chrome remote debugging on my USB connected device using myblog.local as an address pushed using the chrome://inspect tool.
I always a not found error.
My question is, do I need to do something extra in order to remotely debug a custom domain registered on my Mac?
Check out Map to custom local domains.
I got it set up once to work with custom local domains, but it took a bit of experimenting. I definitely needed a proxy server to get it working.
I had exactly the same problem on a PC. I followed #Kayce Basques' Map to custom local domains guide and after some perseverance everything is now working.
Kayce's guide requires a proxy server, I've included my working configuration for the Squid open source and free proxy server below.
Squid installation was easy, I just downloaded and installed a pre-compiled Windows binary file and the server appeared in my Windows system tray. It should hopefully be equally simple for OSX and Linux platforms.
All configuration is done inside a squid.conf file accessible from the Squid menu. I followed this simple guide for a Reverse Proxy. Whilst I included everything in that guide I believe the following line is the critical one to get everything working.
cache_peer 192.168.0.2 parent 80 0 no-query proxy-only originserver
In the above line 192.168.0.2 is my PC's internal IP address and 80 is my Apache virtual host port number defined in my Apache Virtual Hosts file. There's another helpful guide here but that guide omits the originserver option and didn't work on my machine though otherwise helpful.
It seems you do need to be connected by USB cable for this to work so I don't quite understand #asolenzal's comment above. Also each time I changed the configuration I ran Path/to/squid.exe -k reconfigure -n Squid in a command window to reload Squid. You can find that command here.

Comet (Ajax Push) in Godaddy dedicated server?

I want to know if it's possible and I'm looking for tutorials to set it up.
APE website says that knowledge of JavaScript programming is sufficent to follow the tutorial however I haven't been able to puzzle even the first 2 lines of the tutorial.
I'm using Ubuntu. After downloading APE I have no idea what to do. I already set up SSH to access the server.
What should be my following steps or where can I find an easier to tutorial to use comet be it through APE or something else?
Assuming your GoDaddy server is running some flavor of Linux, I don't see any reason it would not be possible. I was just looking over the documentation and I am not clear on what part you are having trouble with. What Linux distribution are you using? Do you have SSH access?
If you have ssh access and a root account you should be able to just follow the instructions to get APE running on the default port.
If you are running a Debian dist (Ubuntu and others) it looks like you should download the source from Git and compile it. There are instructions for the compilation there. You can learn about what you need to do wth Git by search for "clone git".
If you can be more specific about what you are having trouble with, we can probably be more helpful. But ultimately you should be able to install this on any dedicated server without issue.