The Linux Page

Setup static network on the Jetson TX2

My Jetson TX2 see from the top, the area with the heat sink and the fan is the actual Jetson card.
(click on image to see 4K version in new window)


I just received my Jetson TX2 so I had to test it!

First I needed to setup the network since by default it wants DHCP which I don't allow by default on my server.

Since it's running Ubuntu, I thought it would be dead easy, but I ran in two interesting settings I hadn't seen before.

Stop Eth0

When you are about to edit an interface, you probably want to first bring it down. If you forget to do this step first, you may have to reboot to get the status back to normal. So run this one:

sudo ifdown eth0

You may want to verify that you need to change eth0 and not another interface. I would imagine that all Jetson cards use eth0, but it may change in the future. I hav a computer that uses p4p1, for example.

You can see the list of available network cards using ifconfig.

Edit eth0 settings

First, you want to edit the interface file named eth0 as follow:

sudo vim /etc/network/interfaces.d/eth0

Note: The default root password (when you use sudo you become root) is nvidia for the nvidia user (although you should change it if you don't setup your board behind a strong firewall!)

Inside the file, enter the usual info so eth0 gets setup with a static IP address:

auto eth0
iface eth0 inet static

You want to change the and other IPs with your LAN IPs, obviously.

Up to here... nothing too bad outside of the fact that it was in a sub-directory in a file named eth0. (I saw that before, it's just the first time I had to deal with this in this way. Usually I just edited the /etc/network/interfaces file directly.)

Restart eth0

Okay, to have the new IP taken in account, we have to restart the network interface, the opposite of the ifdown we ran up there:

sudo ifup eth0

Verify Static IP Address in eth0

Now you've got the correct IP address. You can verify that with ifconfig:

nvidia@tegra-ubuntu:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr 12:34:56:78:9a:bc  
          inet addr:  Bcast:  Mask:
          RX packets:185198 errors:0 dropped:0 overruns:0 frame:0
          TX packets:98299 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:273767068 (273.7 MB)  TX bytes:7816016 (7.8 MB)

As we can see, the inet addr field has the IP address as defined in our edits.

Verify Static IP Address Gateway on eth0

To verify the gateway, use the route command:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         UG    0      0        0 eth0
link-local      *          U     1000   0        0 eth0     *        U     0      0        0 eth0

We see that the default destination has the Gateway IP address we defined in our eth0 interface file and the Flags say "UG" (the 'G' stands for Gateway).

Notice that there is an Iface column that says the Gateway is on eth0.

Testing Internet Connection

Now we're probably interested by the Internet... can we access the Internet?

I will assume that your Gateway computer is correctly setup. If you have an intermediate computer, you'll need to have the FORWARD and POSTROUTING correctly defined in your Linux firewall. Also, if you're like me, you'll have to "pierce" a hole in your firewall so the IP address you just assigned to your Jetson works as expected.

What I do to test whether I can access the Internet, is to test the DNS system. To do that, I simple ping an IP address by hostname. For example:


IBM may or may not allow the ping itself, but at least you should see the hostname replaced with an IP address. When I tried today, I got this one:

PING ( 56(84) bytes of data.

Please hit Ctrl-C quickly to not abuse the ping system offered by IBM or any other company (unless you have your own DNS servers and can ping your own servers.)

Chances are, that won't work first time on Jetson TX1 or Jetson TX2.

ping: unknown host

Fixing the "Nameserver" Configuration

What you need to do is help the OS with the nameserver resolution. Somehow, it does not work out of the box. All I had to do to fix this was to create the /etc/resolv.conf file with:

sudo vim /etc/resolv.conf

You actually probably saw a warning about that file missing when you ran the ifup and ifdown commands:

grep: /etc/resolv.conf: No such file or directory

Okay, now that you are editing the resolv.conf file, type your name servers there instead (that is, it's probably not necessary in the /etc/network/interfaces.d/eth0 file, although I would suggest you leave it in both places.) Like me, enter a couple of DNS entries:


These are from Google. If you have others from your Internet Provider, you may want to use theirs. The Google DNS server is probably further away from you, so it's not a bad idea to your use Internet Provider IPs. If you're at work, ask your IT guy what DNS IPs you should be using or check your other computer(s) and reuse those IPs.

Save this file and now you're ready to rock. Try the ping as shown above and you should see the hostname converted to a corresponding IP address. If so, you're connected to the Internet via a static IP address.

Why should I use a static IP address?

My point of view is that with a static IP address there is no guessing. You can write scripts that directly access your device and make it work as expected.

The DHCP networking protocol introduces some latency that don't exist at all with a static IP. Also once in a while you lose the IP address for some time. Usually the IP is renewed before it goes out of business, but if for whatever that renewal doesn't work, then you're hosed!

Finally, if you want to setup a strong firewall, a DHCP system means any one of your computer that access the network using DHCP may end up with any one of the allowed DHCP IP address. This means that the firewall has to be "wide open" in a similar way for all the computers using DHCP.

Although, obviously, you can force a specific IP address even with DHCP, which I do for my WiFi devices. For example, my Jetson could have been setup using an entry like this in my /etc/dhcp/dhcpd.conf file:

host jetson_tx2 {
    hardware ethernet 12:34:56:78:9a:bc;

You will have to replace the IP address on the fixed-address field and for the DHCP to make that selection, it uses the MAC address which is defined by the hardware ethernet field.

Note that in most cases the MAC address will have 2 or 4 other numbers to the left. Often it looks like 00:80 or something like that. Just use the last 6 numbers. These are always Hexadecimal numbers. The letters are case insensitive.

To find the MAC address when you have access to a computer, use the ifconfig command. It will display the MAC as the hardware address:

eth0      Link encap:Ethernet  HWaddr 12:34:56:78:9a:bc  

The numbers after the HWaddr are those you are interested in.

From the system where you are setting up the DHCP, you can find the hardware IP address in the arp file as follow:

my-computer $ cat /proc/net/arp
IP address       HW type     Flags       HW address            Mask     Device
...        0x1         0x2         12:34:56:78:9a:bc     *        eth4

(the ... represents other entries removed here to keep my own network top secret!)

We recognize the exact same HW address field.

See Also: Playing a video with your Jetson TX1/TX2 from the command line