View previous topic :: View next topic |
Author |
Message |
pablo_supertux Advocate
Joined: 25 Jan 2004 Posts: 2931 Location: Somewhere between reality and Middle-Earth and in Freiburg (Germany)
|
Posted: Mon Jun 27, 2022 2:20 pm Post subject: [nmcli] replace ip address in edit mode |
|
|
I have an interface that has the IP address 192.168.10.1/24. I wanted to change it to 192.168.10.10/24
Code: |
nmcli connection edit eth1-static
nmcli> print ipv4.addresses
ipv4.addresses: 192.168.10.1/24
nmcli> set ipv4.addresses 192.168.10.10/24
nmcli> print ipv4.addresses
ipv4.addresses: 192.168.10.1/24, 192.168.10.10/24
|
My problem ist that the set command just appended the new address to ipv4.addresses. I cannot find a way to remove entries from the list, I can only add new elements to the list. And even calling set ipv4.address 192.168.10.10/24 the IP is added to the list instead of replacing it.
How can you do that in the edit mode? I'm aware that I can do that with nmcli conn mod eth1-static ipv4.addresses "192.168.10.10/24" but like I said, this is not the case in the edit mode. _________________ A! Elbereth Gilthoniel!
silivren penna míriel
o menel aglar elenath,
Gilthoniel, A! Elbereth! |
|
Back to top |
|
|
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3879
|
Posted: Mon Jun 27, 2022 3:52 pm Post subject: |
|
|
Try
Code: |
nmcli con mod eth1-static ip4 192.168.10.10/24
or if not working
nmcli con mod eth1-static ipv4.address 192.168.10.10/24
#### INITIALLY IP IS ASSIGNED BY IP4 AND AND WHEN MOD-ING BY IPV4.ADDRESS SAME GOES WITH IP(V)6
|
If you still get two addresses try
Code: |
nmcli con mod eth1-static -ipv4.address <ip-to-remove/24>
|
In the unlikely case that there is a chaos going on try
Code: |
nmcli con del eth1-static #### CAUTION YOU WILL BRIEFLY LOOSE CONNECTIVITY
nmcli con add type ethernet con-name eth1-static ifname <physical-iface-name> ip4 192.168.10.10/24 gw4 <router-ip-no-cidr>
nmcli con mod eth1-static ipv4.dns <dns-ip-no-cidr> ipv4.method manual
nmcli con up eth1-static
|
Quote: |
How can you do that in the edit mode? I'm aware that I can do that with nmcli conn mod eth1-static ipv4.addresses "192.168.10.10/24" but like I said, this is not the case in the edit mode.
|
Just saw this.
Why use edit mode then?
Maybe
Code: |
nmcli>remove ipv4.addresses <ip-to-remove/24>
nmcli>save
|
See
Quote: |
nmcli> ?
------------------------------------------------------------------------------
---[ Main menu ]---
goto [[setting] | [prop]] :: go to a setting or property
remove [setting][.[prop]] | [prop] :: remove setting or reset property value
set [[setting].[prop] [value]] :: set property value
describe [[setting].[prop]] :: describe property
print [all | [setting][.[prop]]] :: print the connection
verify [all | fix] :: verify the connection
save [persistent|temporary] :: save the connection
activate [[ifname]] [/[ap]|[nsp]] :: activate the connection
back :: go one level up (back)
help/? [[command]] :: print this help
nmcli [conf-option] [value] :: nmcli configuration
quit :: exit nmcli
------------------------------------------------------------------------------
nmcli>
|
Again why choose a more complicated approach over a simpler one? _________________
|
|
Back to top |
|
|
|