Are you using aternos or Made a custom server?
If Made a custom then this might work
The thing is that the same network provider doesn't help at all If u really need to play with your friends u need same wifi means same connect in other ways if my wifi is named example then me and my friends should be connect to example not will other of the Wifi and if u can't try to join then forward your port
I think u meant lan server lol.
But i use an aternos server!!
Sorry if my original post was hard to understand.
If it makes it any easier to understand ill make a quick little
explanation
I use a certain internet service provider. Lets name it Wifi A.
My friends on the other hand, use a different internet service provider, so lets call it Wifi B.
When i try to connect to my server using Wifi A i have trouble joining and often get kicked due to keepalive timeout.
But when i connect to Wifi B, everything seems to work alright.
My friend uses Wifi A aswell, but he cant switch internets like I can.
Essentially theyre like different brands of wifi.