How to change ip address in orin

hello.
In my project, I need to set eth0 ip 192.168.1.*, when the orin connect with my lidars.
But if I find it connected to another device, the ip must set as Automatic(DHCP). (not reboot system)

How can I change static ip to automatic by cmd or program?

Hi @wangliyong

DHCP

To keep it simple, I have used this to get auto (dhcp) configuration:

Bring interface down

ifconfig eth0 down

Add

iface eth0 inet dhcp

To the file:

/etc/network/interfaces

Then bring the interface up, it will be configured by the dhcp

ifconfig eth0 up

Static

And to configure it static,

Bring the interface down,

ifconfig eth0 down

Remove the previous line from

/etc/network/interfaces

Bring the interface up

ifconfig eth0 up

Configure the interface static, for example:

sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0
sudo route add default gw 192.168.1.1 eth0

Hope this helps a little.

Regards,
Roberto Gutierrez,
Embedded SW Engineer at RidgeRun
Contact us: support@ridgerun.com
Developers wiki: https://developer.ridgerun.com/

4 Likes

It works, it’s really help to me.

Thank you very much, Robertogs2.

There is an problem. after set static ip:
sudo ifconfig eth0 192.168.1.2 netmask 255.255.255.0
sudo route add default gw 192.168.1.1 eth0

It works. but after several seconds(less than 1 min), the ip will lost.

Hi,

And does it change it’s IP or it simply disappears?

Regards,
Roberto

This isn’t ideal, but you might try configuring that interface from nm-connection-editor (if you don’t have this, then “sudo apt-get install network-manager-gnome”).

It disappears.

I have to Change it by cmd, or by coding.
It has no screen/keyboard/mouse.

Network scripts are rather complicated these days (depends on if it is “managed” or “unmanaged”). Are you able to use the USB virtual wired networking (temporarily) from a host PC? If so, then you can use “ssh -Y 192.168.55.1”, and this will forward GUI requests and run the graphics on the host PC despite not having a monitor on the Jetson. I wouldn’t know what config files to edit on the Jetson if going directly to it (it was a lot less complicated before systemd came along).

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.