Static IP setting for RockPi eth0

Hello, I am using RockPiS and currently need to set static IP for port eth0. I tried to do according to the guide online. But I cannot find the configuration file /etc/network/interfaces , Is there any specific way to set IP on RockPi or I need to create the file to get it work?

I am using Debian Buster system and with DHCP the RockPi works well without any issue.

Thank you in advance for help!

On Armbian, Network manager is the primary tool, but you can actually also set it up via /etc/network/interface or simply use armbian-config utility -> network.

Thank you for the reply! I did a check and found the network service is missing and there is only Network Manager service. I will try to install and check again.

Hello, this is how I set up RockPiS static IP.

  1. sudo apt-get install netplan.io

2.Create / etc / netplan / 01-netcfg.yaml

3.Add in / etc / netplan / 01-netcfg.yaml

network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses:
- 192.168.2.135/24 #you want to set IP
gateway4: 192.168.2.1
nameservers:
search: [mydomain, otherdomain]
addresses: [192.168.2.1, 255.255.255.0]

4.sudo netplan apply

then reboot

1 Like

Hi thanks a lot for your help. As we have Network Manager I tried also on this way:

nmcli con mod connection_name ifname eth0 type ethernet ip4 10.x.x.x/24 gw4 x.x.x.x
nmcli con mod connection_name ipv4.address 10.x.x.x
nmcli con mod connection_name ipv4.method manual
nmcli con mod connection_name connection.autoconnect yes
nmcli con up connection_name

And it works fine for me.

1 Like

This really works. I put something easier to understand.
ip a
sudo nmcli connection show
sudo nmcli con add con-name “wiredLab” ifname eth0 type ethernet
sudo nmcli connection modify “wiredLab” ipv4.address 192.168.0.104/24 ipv4.gateway 192.168.0.1 ipv4.method manual
sudo nmcli connection up “wiredLab”
sudo nmcli connection show
ip a
ping www.baidu.com
sudo nmcli con add con-name “wiredHome” ifname eth0 type ethernet
sudo nmcli connection modify “wiredHome” ipv4.method auto
sudo nmcli connection up “wiredHome”
sudo nmcli connection show
ip a
ping www.baidu.com
#configure automatically on when the OS restart。
sudo nmcli connection modify ‘wiredLab’ connection.autoconnect yes
sudo nmcli connection modify ‘wiredHome’ connection.autoconnect no