# Networkmanager keeps dropping internet connection

## George528

Hello, i have a problem with networkmanager - it keeps losing/dropping internet connection. This can happen anytime. When it happens, i check ifconfig and see my inet (ipv4) adress is missing. Only inet6 remains, but that doesn't help me. I have to reset networkmanager everytime this happens, it can become frustrating when you leave your computer overnight to work on something and next day you see that the internet connection was down for the last 6 hours. Someone advised me to switch to netifrc (i use gentoo), but i didn't like it because of wpa_supplicant. Imo, networkmanager manages wireless connection much easier. So i switched back to networkmanager. Here are some details i noticed:

when (re)starting networkmanager

```
* Starting NetworkManager ...                                                      [ ok ]

Connecting...............    0s [offline]

 * Marking NetworkManager as inactive. It will automatically be marked

 * as started after a network connection has been established.

 * WARNING: NetworkManager has started, but is inactive
```

rc-update output:

```
$ rc-update show

        NetworkManager |      default

            acpilight | boot

               binfmt | boot

             bootmisc | boot

              cgroups |                                 sysinit

                 dbus |      default

                devfs |                                 sysinit

                dmesg |                                 sysinit

                 fsck | boot

             hostname | boot

              hwclock | boot

              keymaps | boot

            killprocs |                        shutdown

    kmod-static-nodes |                                 sysinit

                local |      default nonetwork

           localmount | boot

             loopback | boot

              modules | boot

             mount-ro |                        shutdown

                 mtab | boot

               procfs | boot

                 root | boot

         save-keymaps | boot

    save-termencoding | boot

            savecache |                        shutdown

                 sshd |      default

        stmpfiles-dev |                                 sysinit

      stmpfiles-setup | boot

                 swap | boot

               sysctl | boot

                sysfs |                                 sysinit

         termencoding | boot

                 udev |                                 sysinit

         udev-trigger |                                 sysinit

              urandom | boot
```

ifconfig output:

```
$ ifconfig

eth0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether dc:0e:a1:3e:51:e4  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.0.15  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 fe80::c60b:31e8:d8ac:a0c2  prefixlen 64  scopeid 0x20<link>

        inet6 2a00:1858:1018:8514:3628:63db:b622:eb7c  prefixlen 64  scopeid 0x0<global>

        inet6 2a00:1858:1018:8514::1  prefixlen 128  scopeid 0x0<global>

        ether 0c:37:96:12:1f:8c  txqueuelen 1000  (Ethernet)

        RX packets 6926  bytes 5366365 (5.1 MiB)

        RX errors 0  dropped 94  overruns 0  frame 0

        TX packets 5480  bytes 893846 (872.8 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.0.14  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 2a00:1858:1018:8514::2  prefixlen 128  scopeid 0x0<global>

        inet6 2a00:1858:1018:8514:f513:2c69:e3a:9da1  prefixlen 64  scopeid 0x0<global>

        inet6 fe80::8061:9dc6:8944:ce92  prefixlen 64  scopeid 0x20<link>

        ether 74:31:70:c9:dc:62  txqueuelen 1000  (Ethernet)

        RX packets 92  bytes 30926 (30.2 KiB)

        RX errors 0  dropped 1  overruns 0  frame 0

        TX packets 50  bytes 8338 (8.1 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

Let me know if you need more info for figuring out my problem.

Thanks.

----------

## Jaglover

As with any problem you need to examine relevant logs. I do not like and do not use NM, I do not know what its logging capabilities are, perhaps it can write verbose logs. With a problem like this kernel messages also should be investigated. Without any meaningful error messages it is a waste of time.

----------

## Hu

Based on the data so far, it seems like NetworkManager is removing the IPv4 address from the interface.  For how long are DHCP leases issued?  Is NetworkManager attempting to renew the lease?

----------

## George528

 *Hu wrote:*   

> Based on the data so far, it seems like NetworkManager is removing the IPv4 address from the interface.  For how long are DHCP leases issued?  Is NetworkManager attempting to renew the lease?

 

I couldn't find a clear pattern for how often they change. Sometimes it remains the same for a week, sometimes for a day, sometimes after a reboot.

As far as i observed, NetworkManager isn't trying to renew anything.

----------

## George528

 *Jaglover wrote:*   

> As with any problem you need to examine relevant logs. I do not like and do not use NM, I do not know what its logging capabilities are, perhaps it can write verbose logs. With a problem like this kernel messages also should be investigated. Without any meaningful error messages it is a waste of time.

 

where can i find the logs, so i can provide it to you?

----------

## deagol

For my part I would like to first see the syslog messages - anything from the time you know it was last working up to the time you know it to be broken. Add the output of "dmesg -T", too...

Without more data it I only can suspect that something like this is happening:

1) You get a connection problem (disconnect, connection freeze.. whatever)

2) dhcp is not able to renew the lease and the IP is removed.

We should at least see some log message telling us that the renew of the lease failed and then can try to find something in the log indicating why.

But it may also be worthwhile to check if you get the same issue when using a cable: When it's a wlan connection issue chances are good that it's not affecting classical ethernet.

----------

## George528

 *deagol wrote:*   

> For my part I would like to first see the syslog messages - anything from the time you know it was last working up to the time you know it to be broken. Add the output of "dmesg -T", too...
> 
>  *Quote:*   Without more data it I only can suspect that something like this is happening:
> 
> 1) You get a connection problem (disconnect, connection freeze.. whatever)
> ...

 

 *Quote:*   

> I would like to first see the syslog messages - anything from the time you know it was last working up to the time you know it to be broken. 

 

Networkmanager always behaved like this, since i installed it.

 *Quote:*   

> Add the output of "dmesg -T", too...

 

here is the output:

https://0x0.st/-WMe.txt

 *Quote:*   

> Without more data it I only can suspect that something like this is happening:
> 
> 1) You get a connection problem (disconnect, connection freeze.. whatever)
> 
> 2) dhcp is not able to renew the lease and the IP is removed.

 

This is exactly what is happening.

----------

## NeddySeagoon

George528,

```
[Mon Jul 26 12:59:43 2021] wlan0: authenticate with 54:a6:5c:50:48:fd

[Mon Jul 26 12:59:43 2021] wlan0: send auth to 54:a6:5c:50:48:fd (try 1/3)

[Mon Jul 26 12:59:43 2021] wlan0: authenticated

[Mon Jul 26 12:59:43 2021] wlan0: associate with 54:a6:5c:50:48:fd (try 1/3)

[Mon Jul 26 12:59:43 2021] wlan0: RX AssocResp from 54:a6:5c:50:48:fd (capab=0x1411 status=0 aid=5)

[Mon Jul 26 12:59:43 2021] wlan0: associated

[Mon Jul 26 12:59:43 2021] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
```

That's correct. It appears exactly once.

We need the same log after the connection drops.

----------

## George528

 *NeddySeagoon wrote:*   

> George528,
> 
> ```
> [Mon Jul 26 12:59:43 2021] wlan0: authenticate with 54:a6:5c:50:48:fd
> 
> ...

 

Here is how it looks like:

```
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet6 fe80::e4cc:29c2:19db:8137  prefixlen 64  scopeid 0x20<link>

        inet6 2a00:1858:1018:8514::3  prefixlen 128  scopeid 0x0<global>

        inet6 2a00:1858:1018:8514:9489:38c4:dbb7:c188  prefixlen 64  scopeid 0x0<global>

        ether 0c:37:96:12:1f:8c  txqueuelen 1000  (Ethernet)

        RX packets 9398  bytes 1915859 (1.8 MiB)

        RX errors 0  dropped 768  overruns 0  frame 0

        TX packets 2052  bytes 350422 (342.2 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet6 fe80::8061:9dc6:8944:ce92  prefixlen 64  scopeid 0x20<link>

        inet6 2a00:1858:1018:8514:f513:2c69:e3a:9da1  prefixlen 64  scopeid 0x0<global>

        inet6 2a00:1858:1018:8514::1  prefixlen 128  scopeid 0x0<global>

        ether 74:31:70:c9:dc:62  txqueuelen 1000  (Ethernet)

        RX packets 2667  bytes 654489 (639.1 KiB)

        RX errors 0  dropped 73  overruns 0  frame 0

        TX packets 981  bytes 232386 (226.9 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

```

the log now

https://dpaste.com/HC3BBMWFP

----------

## NeddySeagoon

George528,

None of your interfaces except lo have an IPv4 address but IPv6 is still good.

Indeed, I can get ping responses from your public IPv6 addresses.

```
[Mon Jul 26 17:40:44 2021] wlan0: deauthenticating from 54:a6:5c:50:48:fd by local choice (Reason: 3=DEAUTH_LEAVING)

[Mon Jul 26 17:40:44 2021] NetworkManager (1569) used greatest stack depth: 12040 bytes left

[Mon Jul 26 17:40:47 2021] wlan0: authenticate with 54:a6:5c:50:48:fd

[Mon Jul 26 17:40:47 2021] wlan0: send auth to 54:a6:5c:50:48:fd (try 1/3)

[Mon Jul 26 17:40:47 2021] wlan0: authenticated

[Mon Jul 26 17:40:47 2021] wlan0: associate with 54:a6:5c:50:48:fd (try 1/3)

[Mon Jul 26 17:40:47 2021] wlan0: RX AssocResp from 54:a6:5c:50:48:fd (capab=0x1411 status=0 aid=5)

[Mon Jul 26 17:40:47 2021] wlan0: associated
```

Something shut down the WiFi radio link  (Reason: 3=DEAUTH_LEAVING), means that it was told to shut down.

It came back immediately but nothing assigned anything IPv4 addresses.

IPv6 just works.

So, two questions. What shut down Wifi?

How do you expect to get IPv4 addresses assigned?

I'm not a NetworkManager user.

I'll guess that your leases expired and dhcpcd is not running to renew them. Thats easy to test.

Run 

```
dhcpcd wlan0
```

and post the command and the output.

-- edit --

What does 

```
emerge -pv net-misc/networkmanager
```

tell?

----------

## George528

 *NeddySeagoon wrote:*   

> George528,
> 
> None of your interfaces except lo have an IPv4 address but IPv6 is still good.
> 
> Indeed, I can get ping responses from your public IPv6 addresses.
> ...

 

yeah i think dhcpcd doesnt reassign the leases. 

```
dhcpcd wlan0

dhcpcd-9.4.0 starting

DUID 00:04:4a:b9:a4:0f:a1:2b:e1:11:9a:c2:dc:0e:a1:3e:51:e4

dhcp6_openudp: Address already in use

wlan0: connected to Access Point: Big George

wlan0: IAID 70:c9:dc:62

wlan0: soliciting an IPv6 router

wlan0: soliciting a DHCP lease

wlan0: offered 192.168.0.13 from 192.168.0.1

wlan0: probing address 192.168.0.13/24

wlan0: Router Advertisement from fe80::56a6:5cff:fe50:48fc

wlan0: adding address 2a00:1858:1018:8514:998:d34b:dbd8:1ded/64

wlan0: adding route to 2a00:1858:1018:8514::/64

wlan0: adding default route via fe80::56a6:5cff:fe50:48fc

wlan0: soliciting a DHCPv6 lease

dhcp6_openudp: Address already in use

forked to background, child pid 4763
```

```
$ emerge -pv net-misc/networkmanager

These are the packages that would be merged, in order:

Calculating dependencies... done!

[ebuild   R    ] net-misc/networkmanager-1.32.4::gentoo  USE="elogind introspection ncurses nss policykit ppp wext wifi -audit -bluetooth -connection-sharing -dhclient -dhcpcd -gnutls -iptables -iwd -modemmanager -nftables -ofono -ovs -resolvconf (-selinux) -systemd -teamd -test -vala" ABI_X86="(64) -32 (-x32)" 0 KiB

Total: 1 package (1 reinstall), Size of downloads: 0 KiB
```

----------

## NeddySeagoon

George528,

```
wlan0: offered 192.168.0.13 from 192.168.0.1

wlan0: probing address 192.168.0.13/24 
```

That's OK but it should have tested it too.  Is it set?

----------

## George528

 *NeddySeagoon wrote:*   

> George528,
> 
> ```
> wlan0: offered 192.168.0.13 from 192.168.0.1
> 
> ...

 

Sorry i didn't understand what you are trying to say.

How do i make it so dhcpcd automatically reassing leases?

----------

## NeddySeagoon

George528,

It should just do that.

What does the dhcpcd USE flag do to networkmanager?

https://packages.gentoo.org/useflags/dhcpcd says net-misc/networkmanager 	Use net-misc/dhcpcd for getting an IP.

Maybe rebuild network manage with USE=dhcpcd ?

----------

## George528

 *NeddySeagoon wrote:*   

> George528,
> 
> It should just do that.
> 
> What does the dhcpcd USE flag do to networkmanager?
> ...

 

i am emerging networkmanager with dhcpcd USE flag now. I will tell you if i notice any more connection drops

----------

## George528

NeddySeagoon,

ipv4 adress still dissapears after a while, but i need it more than ipv6.

----------

## r7l

George528, did you ever fix this issue? I am facing the same for weeks now. It's on and off. It was ok for a while but it just started to show up again and bugs me like every other hour.

I am running NetworkManager with Systemd and dhcpcd and i am having this issue with my wifi inferface.

----------

