[Tutorial]How to set a static IP address

While it may be obvious to some like myself that have been working with Linux for a while, others it may not be obvious how to set a static IP. So just in case you wanted to know, this is how you can do it from the console.

set a root password in case you have not yet.

At the console, set a root password if you have not done so.

hit alt-f2
login as root
run passwd-root

run the command:
nmcli connection show

You will get an output which looks like this:

Wired connection 1 <UUID> ethernet eth0
zt2oa3epmk <UUID> tun zt2oa3epmk
docker0 <UUID> bridge docker0
virbr0 <UUID> bridge virbr0

run the below commands replacing the IP address with the addresses you want to use:

nmcli con mod “Wired connection 1” ipv4.addresses “192.168.100.100/24”
nmcli con mod “Wired connection 1” ipv4.gateway 192.168.2.1
nmcli con mod “Wired connection 1” ipv4.method manual
systemctl restart NetworkManager

run:
nmcli

to verify the new IP is assigned to the interface.

I usually reboot the system at this point to make sure the change is persistent between reboots.

2 Likes

Thanks you.

Will this survive updates?

Honestly I do not know.

As long as just packages are updated it should, however if the update overwrites the whole OS it may not and you will have to do it again.

No idea what the deal is with this…

Screenshot 2024-07-24 at 10.25.52

I have my router wired into Wired 1 (eth0), so I’m trying to change Wired 2 (eth1) for the NIC adapter.

That’s a strange error…

nmcli device show or just nmcli should show you what the name/device is for eth1

If they are are named eth0 and eth1 you can replace the “Wired connection 2” with eth1

They’re named “Wired connection 1 / 2” on my end as well. And I did try “eth1” in place of that. No idea.

It almost looks like it thinks there’s a character before the W in Wired Connection. You tried eth1 without quotes around it? eth1 I believe would not require the quotes

You could try replacing the double quotes with a single quote.

Unfortunately I have moved on from ZimaOS to TrueNAS Scale so I can’t test it myself right now. If I have time later in the week I can throw ZimaOS on my Zimablade and see if there’s something I can find that way.

The error generates the question mark. Will test without quotes. I think a Zima person said in another thread they’re working to simplify this anyway.

hey, thx for the tutorial, but i am wondering, where you hit “alt + F2” :wink: as it isnt working on the dashboard ^^
connecting via ssh, the root/testonly sitn working as well … mot propably a foolish stupid question :-/

A while ago I went into my router and assigned a static IP to my Cube, and that IP addressed has remained the same ever since. Just thought I’d share in case it might work for others.

I wish they could have made this possible on the web gui instead of going into ssh on the newest update. Newbie with setting up my homeserver lab so any straight forward function thru web gui is appreciated.

Yes, we have already started researching this. We all agree that this feature is very necessary.

1 Like

Thank you. As a newbie like me in linux, I find CasaOS/ZimaOS very intuitive and straight specially the last update. I know doing CLI/SSH is the way to go but I hope making it on a UI that is just a slide of a button or a menu makes the ZimaOS more appealing.

Thank you very much for your support, we will continue to work hard!

Hello, do you know how to create a bridge? I’ve tried with the nmcli commands but when the pc reboots the bridge doesn’t activate.