View: 6617|Reply: 4

Setting gateway using nmcli?

[Copy link]

10

threads

36

posts

154

credits

Registered member

Rank: 2

credits
154
Published in 2017-6-15 21:17:27 | Show all floors |Read mode
Edited by Bazmundi at 2017-6-15 22:14

So, on another thread I explain I can no longer use nmtui to set my static IP using Armbian distro of Debian server.  
This is a weird side effect of installing an expansion board onto my Orange Pi Zero while working with Orange Pi org Debian server distro for OPiZ.  Something broke on the main board after expansion board was inserted.  So, for some reason OPiZ does not boot anymore from Orange Pi org distro of Debian server (with or without expansion board).  

I am stuck with Armbian direct from Armbian org, because (weirdly) it boots, but even weider again is the nmtui now hangs on the connection window.  I can still set host name using nmtui, but the board locks up if I select the connection option.

I was at my wits end to sort this as I need the OPiZ set to a static IP for the use to which it will be put.

So, what I found was that nmcli did not hang the OPiZ.

Bonus right!

So I set the static IP!

Great yes?

No.

As usual the internet is full of crap and versions of versions of stuff.

To set the gateway using nmcli some site suggest you type the following at the nmcli console:
  1. nmcli con edit 'Wired connection 1' # being the ethernet connection eth0 on the OPiZ
  2. nmcli> set ipv4.gateway 192.168.0.1
  3. nmcli> save
  4. nmcli> quit
Copy code


and voila!

BUT

guess what?

Armbian version of nmcli does not have "gateway" as a property under "ipv4"

How do you therefore set the gateway please using nmcli in ARMBIAN 5.25 stable Debian GNU/Linux 8 (jessie) 3.4.113-sun8i?

Cheers,
B













10

threads

36

posts

154

credits

Registered member

Rank: 2

credits
154
 Author| Published in 2017-6-15 22:12:46 | Show all floors
Edited by Bazmundi at 2017-6-16 10:48

So, when is linux not linux?

I found a way to setup gateway under /etc/network/if-up.d/

It requires using the route command.

Something like the following in a file under directory /etc/network/if-up.d/:

  1. #!/bin/sh

  2. if [ "$IFACE" = "eth1" ]; then
  3. route delete default gw 192.168.1.10
  4. route add default gw 192.168.1.1
  5. fi
Copy code


However, you guessed it, under Armbian the route command above returns the following error:

  1. SIOCADDRT: No such process
Copy code


What is going on with Armbian?

Why does it diverge so much from the mainstream?

So, where I thought I could get away with the problem were the Armbian version of nmcli does not have ipv4.gateway, I get bitten because it doesn't seem to want to set the gateway via route either.

Ideas please?

10

threads

36

posts

154

credits

Registered member

Rank: 2

credits
154
 Author| Published in 2017-6-15 23:45:21 | Show all floors
Edited by Bazmundi at 2017-6-15 23:54

Okay, it took some reading between the lines as there was no mention of "gateway" in the Armbian nmcli help, but then it dawned on me the idea of "hops" from networking 101.  So it turned out the fix was:
  1. nmcli con edit 'Wired connection 1'
  2. nmcli> set ipv4.addresses 192.168.0.100/24 192.168.0.1
  3. nmcli> save
  4. nmcli> quit
Copy code






0

threads

2

posts

12

credits

Novice

Rank: 1

credits
12
Published in 2022-12-26 16:17:46 | Show all floors
Well to have understandable information about setting the IP address problem with networking. There are numerous people who are getting solutions through online edubirdie review resources and these are assailable. Continue to share online further help for the public always.

0

threads

15

posts

54

credits

Registered member

Rank: 2

credits
54
Published in 2023-5-23 00:09:36 | Show all floors
There are several misconceptions surrounding car shipping that can lead to confusion. In this blog post, we'll debunk common myths and clarify misconceptions related to car shipping in the USA. Auto Shipping Rates Sanpete County, Utah

You need to log in before you can reply login | Register

Points Rule

Quick reply Top Return list