Menu

Can't connect to FreeBSD host

Martin
2017-12-30
2018-11-07
  • Martin

    Martin - 2017-12-30

    I am trying to connect to my (test) FreeBSD host but though;

    vboxwebsrv is running and sockstat -l -4 shows:

    USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
    martin vboxwebsrv 710 8 tcp4 127.0.0.1:18083 :

    I get "Failed to Connect - 500 Can't connect to 192.168.1.70:18083"

    This is my /etc/rc.conf
    vboxwebsrv_enable="YES"
    vboxwebsrv_user="martin"
    vboxwebsrv_passwd="password"
    vboxwebsrv_logfile="/var/log/vboxwebservice.log"
    vboxwebsrv_host="192.168.1.70"

    But Nmap scan report for 192.168.1.70 says port is closed

    Host is up (0.023s latency).
    PORT STATE SERVICE
    18083/tcp closed unknown
    Nmap done: 1 IP address (1 host up) scanned in 0.11 seconds

    Anybody any suggestions about what I am doing wrong?

     
  • Ian Chapman

    Ian Chapman - 2017-12-31

    Looking at the output, the vboxwebsrv is only binding to the loopback address so you won't be able to use an external IP. I don't know how VirtualBox is integrated into the FreeBSD services, but does the log file showing anything useful? You may need to create the log file and set ownership correctly (ie in your case for the user martin) before the vboxwebsrv will write it it.

    Is your network started before the web service is trying to start?

    Try a simple test as follows also, run the following from the shell as the user martin

    vboxwebsrv -H 192.168.1.70 -t0

    Connect with RemoteBox.

     
  • Ian Chapman

    Ian Chapman - 2017-12-31

    Hi Martin,

    I've installed FreeBSD so I can take a look for you. It seems fairly straight forward. This was done on FreeBSD 11.1 with virtualbox-ose pkg binary. I'm assuming VirtualBox has been setup according to the package instructions. This is for the web service. This info pretty much came from the rc script. Obviously replace the username (ian in my case) and IP address here with what's appropriate for you. I'm also assuming

    AS ROOT

    touch /var/log/vboxwebservice.log
    chown ian:ian /var/log/vboxwebservice.log
    chmod 755 /var/log/vboxwebservice.log

    Add the following service lines ro /etc/rc.conf You don't any of the others. If you require additional flags, add them to the flags line.

    vboxwebsrv_enable="YES"
    vboxwebsrv_user="ian"
    vboxwebsrv_flags=" -H 192.168.1.59 -t0 -F /var/log/vboxwebservice.log"

    Reboot, or use the rc script to stop / start the service

    /usr/local/etc/rc.d/vboxwebsrv start
    /usr/local/etc/rc.d/vboxwebsrv stop

     
  • Martin

    Martin - 2017-12-31

    Hello Ian,

    I find it incredible that you have taken all the trouble to create a complete FreeBSD setup for this problem. I am very grateful to you. Now It works.

    And not only am I grateful for your solution, but even more for RemoteBox. I love it!

    Thanks a lot and I have made you a donation.

    Best whishes and a happy New Year

    Martin

     
    • Ian Chapman

      Ian Chapman - 2017-12-31

      You're very welcome Martin, I'm glad that helped. Thanks for posting the question in the forum too because it always helps others. There's a couple of improvements I can make for FreeBSD users too. I also plan to disable the warning about the extension pack for FreeBSD server users as it obviously isn't available. Also, when you log in, RemoteBox tries to add the guest additions ISO automatically but it doesn't seem to work on a FreeBSD server, but that's a RemoteBox preference which can be disabled.

       
  • Martin

    Martin - 2017-12-31

    Hello Ian,

    Everything is working fine now. Except for SSL. I made the certifcates etc. but I can't connect with SSL.

    The reason might be that, as I am not a programmer, I don't know where (what line number?) I need to put underneath two lines into usr/local/etc/rc.d/vboxwebsrv (I suppose that is the config file you mean? And ofcourse I changed the lines to my directories)

    VBOXWEB_SSL_PASSWORDFILE="/home/virtual/vboxwebcerts/vboxweb.pwd"
    VBOXWEB_SSL_KEYFILE="/home/virtual/vboxwebcerts/vboxweb-both.crt"

     
  • Ian Chapman

    Ian Chapman - 2018-01-01

    Hi Martin. On a FreeBSD server, it doesn't really need/use that config file (/etc/default/virtualbox). I think that's where the confusion is. Almost all config options should be passed on the flags line in /etc/rc.conf

    I haven't tested this yet on a FreeBSD server, but I'm sure you'll need to change the flags line as follows to enable SSL. Obviously change your IP / paths as appropriate.

    vboxwebsrv_flags=" -H 192.168.1.59 -t0 -F /var/log/vboxwebservice.log --ssl -K /home/virtual/vboxwebcerts/vboxweb-both.crt -a /home/virtual/vboxwebcerts/vboxweb.pwd"

    If you want to see more output in the log file which might help with fixing things which aren't working, you can also add a -v. Obviously the above assumes you've aleady created the certs and set the permissions correctly on the files (as mentioned in the manual).

    Let me know how it goes. If it doesn't work for you, I'll try and see what happens. :-)

     
    • Martin

      Martin - 2018-01-01

      Hello Ian.

      Infortunateley SSL still does not work. Because of the flag you added port 18083 now also no longer is present. (with netstat -a | grep LISTEN)

      Also I am wondering if I could use SSH to set up a secure connection. I don't have experience with SSH port forwarding, but would ssh -L 4389:localhost:18083 -p123456 username@192.168.1.70 give me a secure freerdp connection as I can do a secure login this way on my remote server?
      If not: If you have instructions ready available how to configure it the right way, please let me know.

       

      Last edit: Martin 2018-01-01
  • Ian Chapman

    Ian Chapman - 2018-01-02

    No worries, I'll get back to you on this. I'm in the process of doing some major upgrades on my virtualization server so I can't easily test at the mo, but will once it's back up.

     
    • Martin

      Martin - 2018-01-02

      Hi Ian,

      As far as I can see now Virtualbox is working fine with RemoteBox and I can start a VM.

      But then I run into another problem. When I start a VM with Remote Display Server enabled and Auth. Method either as external or guest or without authentication I don't get the VM display.

      Also when I try from outside RemoteBox: xfreerdp /size:1280+1024 /u:(vboxuser) name /p: (vboxuser) password /v:192.168.1.70:3389 I don't get a display but the following error "connected to 192.168.1.70:3389 Error: protocol security negotiation or connection failure." It really becomes connected, because when I close the VM I get "unable to connect" Netstat shows:
      tcp4 0 0 .rdp star.star LISTEN
      tcp4 0 0 192.168.1.70.18083 star.star LISTEN

      I have no firewall installed yet, SSL is disabled, and I disabled port 22 for another port.

      Also when I try to login without credentials (display= without authentication) I get "protocol security negotiation or connection failure."

      So it looks like there is a connection failure.

      In the meantime I have everything installed on a server that can be reached from the internet. So if you want to see yourself I can mail the RemoteBox login credentials to you. Just let me know.

       

      Last edit: Martin 2018-01-02
  • Ian Chapman

    Ian Chapman - 2018-01-04

    Martin, as far as I know the FreeBSD version of VirtualBox actually uses the VNC protocol and not the RDP protocol that the other versions of VirtualBox use. This is because there's no VirtualBox extensions for FreeBSD, only Linux, Solaris, Windows and MacOS X. So I'm assuming that you'll need to specify a VNC client in the Guest Display option of the RemoteBox preferences. Note, this isn't tested as FreeBSD (server side) isn't explicitly supported by RemoteBox as I haven't extensively tested it. Having said that, I'm happy to do improve RemoteBox where it can be. My virtualization server is back now after having a motherboard replacement so I'll do some more testing this weekend and post my findings. Thanks :-)

     
  • Martin

    Martin - 2018-01-04

    Hello Ian,

    I actually was planning to try VNC myself today. I will keep you informed.

     
  • Martin

    Martin - 2018-01-04

    I succeeded in connecting to a Virtual Machine with a VNC vlient.
    But got an error in the VNC client saying "cpu doesn't support long mode"

    Now you know anyway that it is possible to connect a VNC client to virtualbox on FreeBSD.
    I suppose it will not be too difficult for you to incorporate this in RemoteBox, which would be very nice.

    Instuctions:
    1.COMPILE VIRTUALBOX
    cd /usr/ports/emulators/virtualbox-ose
    make config
    enable DBUS, UDPTUNNEL, VDE, VNC, WEBSERVICE
    make install clean
    install /etc/r.conf and /boot/loader.conf settings

    2.CREATE VM
    VBoxManage createvm --name testvm --ostype FreeBSD --register
    VBoxManage modifyvm testvm --memory 256 --boot1 dvd --nic1 bridged --bridgeadapter1 igb1
    VBoxManage createhd --filename "testvm.vdi" --size 10000
    VBoxManage storagectl testvm --name "SATA Controller" --add sata --controller IntelAHCI --hostiocache on
    VBoxManage storageattach testvm --storagectl "SATA Controller" --port 0 --device 0 --type hdd --medium "testvm.vdi"
    VBoxManage storagectl testvm --name "IDE Controller" --add ide --controller PIIX4
    VBoxManage storageattach testvm --storagectl "IDE Controller" --port 0 --device 0 --type dvddrive --medium testvm.iso

    1. PREPARE FOR VNC
      VBoxManage modifyvm testvm --vrdeproperty VNCPassword=somepass
      VBoxManage modifyvm testvm --vrdeauthlibrary null
      VBoxManage modifyvm testvm --vrdeport 5901
      VBoxHeadless --startvm testvm --vrde on
     
  • Ian Chapman

    Ian Chapman - 2018-01-06

    All of the VM management tasks in the above can be done from RemoteBox. The actual important bit really is this line:

    vboxmanage modifyvm testvm --vrdeproperty VNCPassword=somepass

    Which needs to be done as the same user that you run the web service as. This sets the VNC password for the VM.

    To integrate the display within RemoteBox you'll need a VNC client installed. Lets assume TigerVNC for this, and it's binary is normally installed as vncviewer. To integrate with RemoteBox, go to the RemoteBox preferences window, then the guest display tab and in the RDP Client field, enter the following

    vncviewer %h:%p

    Now when you connect it should option the display. TigerVNC will prompt you for a password etc. Note, that the display options in a guest settings in RemoteBox apply to the RDP client and not VNC.

     
  • Martin

    Martin - 2018-01-09

    Hi Ian,

    Though I succeeded in creating VM's with RemoteBox and also succeeded in setting up VM's within FreeBSD manually and run a VNC console from my linux guest I still did not yet succeed in connecting to the console of a running VM created with RemoteBox.

    I suspect it has to do with proper "user rights" settings and with the fact that I created a special vboxuser.

    In order to find out what I am doing wrong I would like to ask you, as I suppose you already created VM's with RemoteBox on FreeBSD yourself and also connected to them with TigerVNC, if you could send me the same kind of instructions how you did that as I did in my last post about my manual setup in FreeBSD? I would appreciate that very much.

    Thanks

     
  • Ian Chapman

    Ian Chapman - 2018-01-13

    Hi Martin,

    I really didn't do any more than what was posted. In preferences for the VM, make sure you have the remote display server enabled. On the server you need to run the following command as the user that the web service runs as

    vboxmanage modifyvm testvm --vrdeproperty VNCPassword=somepass

    Unfortunately it's no possible to set the VNC password any other way as far as I known.

    In remotebox, have this set up as the RDP client

    vncviewer %h:%p

    Make sure you have TigerVNC installed on the client machine where you're running RemoteBox.

    I suggest adding some screenshots so I can see what it looks like for you?

     
  • Martin

    Martin - 2018-01-13

    Hello Ian,

    Thank for your support, but at the moment I am busy with some hardware changes. So I wont't be able to take a look at it again before next monday. I will keep you informed. Thanks

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.