netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Strange behavior of command ip
@ 2024-08-15 22:16 Freek de Kruijf
  2024-08-15 23:37 ` Jacob Keller
  0 siblings, 1 reply; 2+ messages in thread
From: Freek de Kruijf @ 2024-08-15 22:16 UTC (permalink / raw)
  To: netdev

I have the following bash script:

#!/bin/bash
getipv6() {
nmcli con modify "Wired connection 1" ipv6.addr-gen-mode eui64
nmcli con down "Wired connection 1"
nmcli con up "Wired connection 1"
/usr/bin/ip -6 a
}
getipv6

When I run the script the output is:

Connection 'Wired connection 1' successfully deactivated (D-Bus active path: /
org/freedesktop/NetworkManager/ActiveConnection/23)
Connection successfully activated (D-Bus active path: /org/freedesktop/
NetworkManager/ActiveConnection/24)
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 fe80::dea6:32ff:fe55:12be/64 scope link tentative noprefixroute 
       valid_lft forever preferred_lft forever

When I run the command "/usr/bin/ip -6 a" the output is:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
    inet6 ::1/128 scope host noprefixroute 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
    inet6 2001:4c3c:702:b700:dea6:32ff:fe55:12be/64 scope global dynamic 
noprefixroute 
       valid_lft 4126sec preferred_lft 3466sec
    inet6 fe80::dea6:32ff:fe55:12be/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Now the global IPv6 of eth0 is shown.

-- 

vr.gr.

Freek de Kruijf




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Strange behavior of command ip
  2024-08-15 22:16 Strange behavior of command ip Freek de Kruijf
@ 2024-08-15 23:37 ` Jacob Keller
  0 siblings, 0 replies; 2+ messages in thread
From: Jacob Keller @ 2024-08-15 23:37 UTC (permalink / raw)
  To: Freek de Kruijf, netdev



On 8/15/2024 3:16 PM, Freek de Kruijf wrote:
> I have the following bash script:
> 
> #!/bin/bash
> getipv6() {
> nmcli con modify "Wired connection 1" ipv6.addr-gen-mode eui64
> nmcli con down "Wired connection 1"
> nmcli con up "Wired connection 1"
> /usr/bin/ip -6 a
> }
> getipv6
> 
> When I run the script the output is:
> 
> Connection 'Wired connection 1' successfully deactivated (D-Bus active path: /
> org/freedesktop/NetworkManager/ActiveConnection/23)
> Connection successfully activated (D-Bus active path: /org/freedesktop/
> NetworkManager/ActiveConnection/24)
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
>     inet6 ::1/128 scope host noprefixroute 
>        valid_lft forever preferred_lft forever
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
>     inet6 fe80::dea6:32ff:fe55:12be/64 scope link tentative noprefixroute 
>        valid_lft forever preferred_lft forever
> 
> When I run the command "/usr/bin/ip -6 a" the output is:
> 
> 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 state UNKNOWN qlen 1000
>     inet6 ::1/128 scope host noprefixroute 
>        valid_lft forever preferred_lft forever
> 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 state UP qlen 1000
>     inet6 2001:4c3c:702:b700:dea6:32ff:fe55:12be/64 scope global dynamic 
> noprefixroute 
>        valid_lft 4126sec preferred_lft 3466sec
>     inet6 fe80::dea6:32ff:fe55:12be/64 scope link noprefixroute 
>        valid_lft forever preferred_lft forever
> 
> Now the global IPv6 of eth0 is shown.
> 

Most probably nmcli takes time to actually configure the interface and
assign an ipv6 address. I do not know if nmcli waits for this to complete.

You could see if adding a delay between the nmcli and ip invocation in
the script?

According to nmcli the default wait time for nmcli con up is 90 seconds.
However, it is unclear to me what "up" means, and it is quite possible
that it does not include the assignment of the ipv6 address.

Thanks,
Jake

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-15 23:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 22:16 Strange behavior of command ip Freek de Kruijf
2024-08-15 23:37 ` Jacob Keller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).