Jetson/Remote Access

From eLinux.org
< Jetson(Redirected from Tegra/Remote Access)
Jump to: navigation, search

Default Jetson TK1 login credentials

Username: ubuntu

Password: ubuntu

Hostname: tegra-ubuntu

Easy method: Plugging the device into your router

To remotely access your device from your PC, first you need to get your PC and your device on the same local network. If you can plug your Jetson TK1 board directly into a wired ethernet router from the onboard ethernet port or plug a Wifi USB dongle / PCIe card, then this is all you need to do. The device will get a new IP address from the DHCP server in your router, and thus your PC should be able to access your device within 30 seconds or so, and the device should have access to both the PC and the internet such as to download extra software.

Not-as-easy method: Internet Connection Sharing with NetworkManager

If you are running Ubuntu on your PC, or if you use another operating system that has NetworkManager, then you can make your PC act as a router with just a few clicks in a graphical user interface. Just connect the Jetson board to the PC with an Ethernet cable (patch or crossover -- does not matter with modern Ethernet devices) and create an Internet Connection Sharing connection in 6 steps:

  1. Open the Network Menu on your panel (the menu where you usually select wireless connections) and select "Edit connections"
  2. Click on the "Add" button
  3. Select "Ethernet" from the drop-down menu (most likely already selected) and click "Create..."
  4. Give the connection a nice name, e.g. "Jetson"
  5. Open the IPv4 tab.
  6. In the "Method" box, select "Shared with other computers" and click the "Save..." button

Now whenever you plug in the Ethernet cable, both your PC and Jetson will be waiting for a router. You then need to select the "Jetson" connection so that your PC would act as a router for Jetson. Now you can log in as described in Accessing the device from your PC section.

Hard method: Manually setting up a DHCP server

If you can't plug your device into your router, then it becomes more complicated because you will need to setup a small LAN network between your PC and your device. This page describes how you can perform that. To do this, plug a single Ethernet crossover cable from your PC to your device's Ethernet port. By default, the device waits to be allocated a dynamic IP address from a DHCP server, and your PC Ethernet port probably does too. So you need to either set them both to use static IP addresses on the same subnet, or run a DHCP server on your PC to give a dynamic IP address to your device without necessarily modifying the device in any way. Running a DHCP server is harder than setting up a static IP network, but it doesn't require making any changes to your device, since it defaults to looking for a DHCP server, so let's see how to do that on your PC. There are many guides available on the web, showing how to setup a DHCP server on your Windows or Mac PC, but this page will show how to set it up on a Linux PC.

DHCP Server using the simple dnsmasq tool

Dnsmasq provides both a simple DNS name server and a simple DHCP server. To run both a DNS & DHCP server from a Linux host PC on ethernet using IP address 192.168.1.100, follow these steps (tested on Debian Wheezy KDE, Linux Mint 16 KDE and Ubuntu 12.04):

sudo apt-get install dnsmasq

If you are using NetworkManager (that is enabled by default in many graphical desktop environments like GNOME, KDE or Unity), you probably need to turn it off for now so it doesn't interfere with your local network server:

# Check if any network manager is running
ps -ef | grep -i net
# Kill any network manager that was running, using "sudo kill <pid>" or "sudo pkill <process-name>"
sudo pkill NetworkManager
sudo nano /etc/dnsmasq.conf

Copy-paste this anywhere in the file such as at the top (note: Ctrl+V means PageDown in nano, so you might want to use Shift+Insert to paste instead):

# Based on "https://wiki.debian.org/HowTo/dnsmasq":
# Stop dnsmasq reading any other files like /etc/resolv.conf for nameservers
no-resolv
# Set the local network device
interface=eth0
# Specify IP addresses in the format: first,last,lease_time
dhcp-range=192.168.1.100,192.168.1.110,12h
# Set the DNS nameserver addresses to send to the clients, such as Google DNS or OpenDNS
server=8.8.8.8
server=8.8.4.4

Restart the dnsmasq service:

sudo /etc/init.d/dnsmasq restart

Bring up the local network using the first IP address:

sudo ifconfig eth0 up 192.168.1.100 netmask 255.255.255.0

Your local network should now be up & running! To see DHCP server error messages, or see when a new computer has grabbed an IP from this DHCP server:

sudo tail -30 /var/log/syslog

Since dnsmasq is also a DNS server, you can access the device using its hostname "tegra-ubuntu" instead of the IP address "192.168.1.101". eg:

ping tegra-ubuntu

(If this doesn't work, perhaps it has been renamed to something like "tegra-ubuntu.local" instead. You can see the name using "sudo arp").

To permanently set a name for the device on a Linux host PC

Add a line such as "192.168.1.101 tegra-ubuntu" to your PC's "/etc/hosts" file using root permissions, and then dnsmasq will instantly allow you to use this hostname instead of the IP address:

1) Open a shell terminal (In Ubuntu Unity I think you can click the top-left icon and search for "terminal" then run it).

2) Open the "/etc/hosts" file in an editor, using root permissions. eg: "sudo nano /etc/hosts"

3) Type in your password. If you haven't changed from the default password, it would be "ubuntu".

4) Paste this line into that file, ideally as the line after the existing similar looking lines near the top of the file:

192.168.1.101   tegra-ubuntu

(You might need to change that IP address to whatever IP your board is currently using).

5) Click "Save" and close it. It should work instantly.

Enable NAT internet connection sharing so that the local network can access internet from the host computer's Wifi or Ethernet connection

Note: You might need to change "wlan0" (your network device that has internet) and "eth0" (you local network device that has the Jetson board) for your computer setup.

Put this into a new file named "share_my_internet.sh":

#!/bin/sh
# Share one network's internet connection with another network.
# eg: If your Wifi adapter with internet is called wlan0
# and your local Ethernet adapter is called eth0,
# then run:
#    ./share_my_internet.sh wlan0 eth0
# This will only last until you reboot your computer.
sudo iptables --flush
sudo iptables --table nat --flush
sudo iptables --delete-chain
sudo iptables --table nat --delete-chain
sudo iptables --table nat --append POSTROUTING --out-interface $1 -j MASQUERADE
sudo iptables --append FORWARD --in-interface $2 -j ACCEPT
sudo sysctl -w net.ipv4.ip_forward=1

Then make that script an executable:

chmod +x share_my_internet.sh

Now you can run it, passing first the name of your internet adapter (eg: wlan0) and your local network adapter (eg: eth0):

./share_my_internet.sh wlan0 eth0

(You will need to execute this script again if you reboot your desktop computer, so you might want to add something like "~/share_my_internet.sh wlan0 eth0" to the bottom of your "~/.bashrc" login script so it gets executed automatically).

If you are using a graphical desktop environment and thus you killed NetworkManager earlier, now you should re-start NetworkManager to give you back your regular internet:

sudo service networking start
sudo service network-manager start

Bring up the local network using the first IP address:

sudo ifconfig eth0 up 192.168.1.100 netmask 255.255.255.0

Now your device should have internet access!

Troubleshooting

If you reboot your device &/or desktop and can no longer access tegra-ubuntu or 192.168.1.100 or 192.168.1.101, you can bring up the local network again from your PC using the same command as earlier, eg:

sudo ifconfig eth0 up 192.168.1.100 netmask 255.255.255.0

If your device can't access internet but your desktop can then run the internet sharing command again:

./share_my_internet.sh wlan0 eth0

If your desktop can't access internet then remember to re-enable your desktop's GUI network manager:

sudo service networking start
sudo service network-manager start

Accessing the device from your PC

First you should see if you can ping the device:

ping tegra-ubuntu

Assuming this works, log into your device from your PC:

ssh ubuntu@tegra-ubuntu

Or if you want to use graphical apps on the device display it on your PC using "X forwarding":

ssh -X ubuntu@tegra-ubuntu nautilus

You should now have full remote access to the device. The only remaining feature to test is if the device has internet access. Note: By default the device won't have ICMP ping service enabled, so instead of using "ping www.google.com", you can test internet access by running this on the device:

wget www.google.com

You can also get remote desktop access to your device such as by using a VNC or commercial SplashTop / TeamViewer solution, allowing you to run graphical apps easily without needing a HDMI monitor attached to your device. Beware though, that if you are trying to run graphical apps to their limits, some remote desktop solutions such as VNC are unlikely to give you the full performance or GPU acceleration.

Using OpenGL and CUDA without a connected display

Add the following line to the "Screen" section in xorg.conf to avoid detection of the external display.

Section "Screen"
...
Option "UseEdid" "False"
...
EndSection

It may also be possible to use Xvfb