To configure the Ethernet interface eth0 on a Jetson Nano running Ubuntu 22.04 for a direct link to a computer router, you must assign a static IP address within the same subnet as the remote device. This setup bypasses DHCP and requires manual configuration of the network interface file to ensure stable connectivity without an upstream gateway or DNS resolver from a local network.
Understanding Direct Link Networking Requirements
When establishing a direct connection between two devices without a switch or router in between, standard networking protocols like DHCP cannot function because there is no server to lease addresses. Both endpoints must be manually configured with static IP addresses that reside in the same logical subnet. In this scenario, the remote computer acts as the router with the IP10.41.10.1. Your Jetson Nano needs a compatible IP address, such as 10.41.10.2, to communicate directly.
This configuration differs significantly from typical home or office setups where devices obtain settings automatically. You are essentially creating a point-to-point link. The primary challenge lies in correctly defining the subnet mask and ensuring that routing rules do not attempt to send traffic through non-existent gateways. If the configuration is incorrect, the system may appear offline even though the physical link is active. For more context on how Ubuntu manages these interfaces, see How do Ubuntu-server network interfaces work?.
Identifying the Network Interface
Before modifying any configuration files, it is crucial to verify that the correct interface is being targeted. On most Jetson Nano boards, the primary Ethernet port is namedeth0. However, naming conventions can change depending on kernel versions or additional hardware modules. Use the following command in the terminal to list all network interfaces and their current states:
ip link show
Look for the interface associated with your Ethernet cable. It should show a state of UP or DORMANT if the cable is plugged in. If you see multiple interfaces, ensure you are editing the one corresponding to the physical port you intend to use. Misidentifying the interface name will result in changes applying to the wrong adapter, leaving your target connection unconfigured.
Configuring Netplan for Static IP
Ubuntu 22.04 uses Netplan as its default network configuration tool. Netplan reads YAML configuration files located in the/etc/netplan/ directory. These files define how network interfaces behave. To set up a static IP for a direct link, you need to create or modify a Netplan configuration file.
First, identify the existing Netplan configuration file. It usually has a name like 50-cloud-init.yaml or 01-netcfg.yaml. Open the file using a text editor with sudo privileges:
sudo nano /etc/netplan/00-installer-config.yaml
Replace the content with the following structure, ensuring proper indentation which is critical for YAML syntax. Replace 10.41.10.2 with your chosen IP address, ensuring it does not conflict with 10.41.10.1:
network:
version: 2
ethernets:
eth0:
dhcp4: false
addresses:
- 10.41.10.2/24
nameservers:
addresses:
- 8.8.8.8
routes:
- to: 10.41.10.0/24
via: 10.41.10.1
Key points in this configuration:
- dhcp4: false: Disables automatic IP assignment.
- addresses: Sets the static IP and subnet mask (/24 means 255.255.255.0).
- nameservers: Provides external DNS for general internet access if the remote device allows it, or you can remove this line if you only need local communication.
- routes: Defines that traffic destined for the
10.41.10.0/24subnet should go through the router at10.41.10.1.
sudo netplan apply
If the command returns no errors, the configuration has been applied. Verify the new IP address with:
ip addr show eth0
You should see 10.41.10.2 listed under the inet field.
Testing Connectivity and Troubleshooting
Once the configuration is applied, test the connection to the remote router. Use theping command to check reachability:
ping -c 4 10.41.10.1
If you receive replies, the layer 3 connectivity is established. If the ping fails, check the physical link status with ethtool eth0 to ensure the cable is detected. Common issues include incorrect subnet masks or conflicting IP addresses on the remote end. Ensure that firewalls on both devices allow ICMP traffic if you rely on pings for diagnostics.
For users experiencing broader internet connectivity issues after such configurations, it might be helpful to review related problems, such as those found in Ubuntu 22.04 VM on KVM/virt-manager Not Connecting to Internet, as the principles of static vs. dynamic addressing remain similar across different environments.
Advanced Routing Considerations
In some cases, simply adding an IP address is not enough if the remote device expects specific routing behaviors. If you need to route all traffic through the remote computer, you would add a default route:sudo ip route add default via 10.41.10.1 dev eth0
However, this method resets upon reboot unless added to the Netplan file permanently. For persistent default routing, modify the Netplan YAML to include:
routes:
- to: default
via: 10.41.10.1
Be cautious when setting a default route on a direct link. If the remote computer does not have internet access itself, your Jetson Nano will lose all external connectivity. Always keep a secondary management method, such as SSH over Wi-Fi if available, or serial console access, to recover from misconfigurations.
Frequently Asked Questions
What happens if I forget to disable DHCP?
If DHCP remains enabled, the system will attempt to contact a DHCP server on the network segment. Since a direct link typically lacks a DHCP server, the interface may fail to obtain an IP address or fall back to an APIPA address (169.254.x.x), breaking your static configuration. Always setdhcp4: false explicitly.
Can I use a different subnet mask than /24?
Yes, but both devices must agree on the subnet mask. A /24 mask (255.255.255.0) is standard for small direct links. Using a different mask, such as /30, restricts the usable IP range further but is valid if both ends are configured identically. Mismatched masks will prevent communication even if IPs are in the same range.Why can't I access the internet after configuring the static IP?
A direct link configuration often removes the default gateway to the wider internet. If the remote computer does not provide NAT or routing to the internet, your Jetson Nano will only have access to the remote device. You must ensure the remote device is configured to forward traffic or provide a default route if internet access is required.How do I revert to DHCP if the static config fails?
Edit the Netplan YAML file again and changedhcp4: false to dhcp4: true. Remove the addresses and static routes sections. Run sudo netplan apply to restore automatic configuration. This is useful for testing or if you reconnect to a network with a DHCP server.
Is it necessary to configure DNS servers in the Netplan file?
It is necessary only if you need to resolve domain names while connected via the direct link. If you only communicate using IP addresses, you can omit thenameservers section. Including public DNS servers like 8.8.8.8 allows resolution of external domains if the remote router permits such traffic.