SE3910
Tips
  • VM tips
    • Use right-control to escape from the virtual machine.
    • To open terminal in the VM: Applications->Accessories->Terminal
    • From the browser, to copy the path, press Ctrl-L. The graphical folder crumbline will turn into a simple text editor.
  • Linux equivalent of ipconfig: /sbin/ifconfig, or, if the path is set up right, ifconfig. (I hear that ifconfig, if it works, may not give as complete results as /sbin/ifconfig. I haven't confirmed this yet. Perhaps this is because if ifconfig works by itself, you are actually running it on a different machine?)
  • To get a summary of IP addresses:
    • On windows with cygwin, use ipconfig | grep "IPv4"
    • On linux, use /sbin/ifconfig | grep 'inet addr'
  • Pinging Google from the VM
    • If you the bridged adapter is not working, you may want to choose "NAT" instead. With the bridged mode, your VM machine should be reachable from outside the host machine, appearing just like another machine with a different IP on whatever network you laptop is connect to. In NAT mode, your VM can make TCP connections to other machines, but other machines cannot make TCP connections to your VM, since it will not have an IP visible outside of the VM.
    • For example, when NAT (Network Address Translation) is enabled on my VM, a ping google.com command results in packets that use 10.0.2.15 on the VM ...
      ... but use 192.168.1.67 on the host machine:
      Since the host machine's address is 192.168.1.67, to the outside world, it looks like the host machine is sending the request, but whenever the host machine receives a response, it translates it and sends it to the VM (which is why it is called Network Address Translation).
  • Finding the BeagleBone
    • The program nmap (with graphical user interface zenmap) can be quite useful for finding the BeagleBone's IP address. To use it, you must know the subnet that the BeagleBone is on. nmap/zenmap can scan all the IP addresses on that subnet and find all computers that respond to ping.
    • Or, you can log into the BeagleBone through the USB connection, and run the ifconfig command to find out what its other IP address is. Again, it is useful to have some idea what subnet the BeagleBone will be on. For the switches in lab, the subnet is usually 192.168.1.[xxx] (So the subnet mask is 255.255.255.0, the switch itself usually has an IP address of 192.168.1.1, and the devices that connect are often assigned addresses like 192.168.1.100, 192.168.1.101, etc.)
      • More details: Connect to the Bone through Putty and USB to find its IP addresses. Then, from a windows command prompt, find the IP address of your laptop. The subnet of two of these should match. For example, on my system, the bone had one IP address that was 192.168.1.100, and my computer had an IP address that was 192.168.1.103. The switch is acting as a 192.168.1.X subnet DHCP server (It has a subnet mask of 255.255.255.0). When I turn on my virtual machine in bridging mode, it gets an IP of 192.168.1.104, so it virtually appears as another device on the same subnet.
    • Another alternative is to manually set the bone's IP address using something like ifconfig eth0 192.168.1.100 netmask 255.255.255.0, and your computer's address using the Windows GUI (e.g. to 192.168.1.101). You will also need to set your virtual machine's IP address — this is possible to do with the GUI (e.g. to 192.168.1.102). Then you can directly connect the BeagleBone to your computer. Of course, to access the BeagleBone in the first place, you will need either the USB cable, or one of the switches in the lab. But once this is set up, you should, in theory, be able to access your BeagleBone from your dorm room.
    • If you want to get by for now with just one ethernet cable, you can set up your laptop to share its wireless internet connection with the Beaglebone through your laptop's wired ethernet port. In this configuration, the laptopt acts as a "switch" of sorts (that is, as a DHCP server). I've forgotten the configuration commands I use on Windows to share the connection. On the Beaglebone, to look for the DHCP services, edit the file /vim/etc/interfaces. Uncomment the two lines auto eth0 and iface eth0 inet dhcp. Save the file, and run the commands ifdown eth0 and ifup eth0 until ifup succeeds in obtaining an IP address. This approach has been somewhat flakey for me. In future labs, we will want to connect multiple bones, and having multiple ethernet cables will be important.
  • Connecting to the BeagelBone via SSH
    • If you get this error (in this example, while running ssh root@192.168.7.2), while connecting to the Beaglebone,
          @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
          @    WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!     @
          @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
          IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
          Someone could be eavesdropping on you right now (man-in-the-middle attack)!
          It is also possible that a host key has just been changed.
          The fingerprint for the ECDSA key sent by the remote host is
          SHA256:SZFJ4Kho/s35KaeqvmGq1DSEAiZhaGlnP3UVeWE3vwQ.
          Please contact your system administrator.
          Add correct host key in /home/yoder/.ssh/known_hosts to get rid of this message.
          Offending ECDSA key in /home/yoder/.ssh/known_hosts:1
          ECDSA host key for 192.168.7.2 has changed and you have requested strict checking.
          Host key verification failed.
          
      Then move or delete thie .ssh/known_host file, or edit it to remove the line starting 192.168.7.2. This error happens when you change from one beaglebone image to another. It is this sort of error you avoid by telling PuTTY to not remember the BeagleBone every time you connect to it.
  • Alternative to sftp
    • (Alternatively, you can use a command like scp *.cpp *.hpp debian@192.168.7.2:Desktop/camera/ if you have Cygwin installed, or from the VM if you have a network connection from the VM to the Beaglebone.)

    • Another example: the command scp boneCV.cpp root@192.168.7.2: (Include that final colon (:) character.) On the BeagleBone, issue the command

    • Another example: From the folder in the vm, I like to use a command like scp record root@192.168.7.2: (that final colon is important!)
    • Yet another example:

      If files are in

      ~/path/to/folder on the BeagleBone and you want to copy them to the VM,

      (a subdirectory of root's home directory), then run this command from your VM:

      scp root@192.168.7.2:path/to/folder/*.jpg .

      The last . means copy them to the current directory that you execute the command from.

      If the files are not in a subdirectory of your home directory on the BBB, you can use an absolute path. Suppose the path is

      /path/to/folder

      scp root@192.168.7.2:/path/to/file/*.jpg .

      And if the files are in the home directory itself, it is as easy as:

      scp root@192.168.7.2: *.jpg .