Weird (wireless) connectivity issue [SOLVED]
Forum rules
LMDE 2 has reached end of support as of 1-1-2019
LMDE 2 has reached end of support as of 1-1-2019
Weird (wireless) connectivity issue [SOLVED]
Hi all,
I have been experiencing a very weird (at least imo) connectivity issue on my home network the past few weeks and I can't seem to get rid of it. Hope you guys can help out. Here it goes (pardon my lingo if it's not 100% correct).
My setup: LMDE server ('tower') and LMDE client ('thinkpad'). I use tower mainly as a music server (mpd/gmpc) and bittorrent server (rtorrent), not that it really matters. In between there's a linksys router, which is running a dhcp server (ip addresses are bound to mac-addresses). tower has 192.168.1.101, thinkpad has 192.168.1.102. The network configuration is the same on both machines. Subnetmask is 255.255.255.0, gateway (linksys router) is 192.168.1.1 and DNS ip addresses are also the same (can't remember those). There's no firewall involved, both are clean LMDE installs. So there's nothing too fancy, I think...
Now usually everyting's fine (which means I can reach and access tower from thinkpad without any problems). However, when I suspend thinkpad (for a longer time, at least an hour or so), tower becomes unreachable, which means I can't even ping tower from thinkpad (I get 'host unreachable'). ssh gives 'no route to host'. I can ping the gateway and otherwise the connection on both machines is perfectly fine (I can browse the interwebs, etc.). The curious part is though, that as soon as I ping thinkpad from tower everything is OK again (! yes, I've tried this multiple times). Now I don't want to get up every time I want to access tower to ping thinkpad first after a suspended period, so any help would be greatly appreciated. Of course, I've done my share of googling but this one's obviously out of my reach.
I honestly don't know if this issue is wireless specific. Unfortunately, I can't use cables where I live. Maybe this post should be moved to 'Networking'.
Naturally, in case more (specific) information is needed, I'd be more than willing to provide it.
Best regards,
Stijn
I have been experiencing a very weird (at least imo) connectivity issue on my home network the past few weeks and I can't seem to get rid of it. Hope you guys can help out. Here it goes (pardon my lingo if it's not 100% correct).
My setup: LMDE server ('tower') and LMDE client ('thinkpad'). I use tower mainly as a music server (mpd/gmpc) and bittorrent server (rtorrent), not that it really matters. In between there's a linksys router, which is running a dhcp server (ip addresses are bound to mac-addresses). tower has 192.168.1.101, thinkpad has 192.168.1.102. The network configuration is the same on both machines. Subnetmask is 255.255.255.0, gateway (linksys router) is 192.168.1.1 and DNS ip addresses are also the same (can't remember those). There's no firewall involved, both are clean LMDE installs. So there's nothing too fancy, I think...
Now usually everyting's fine (which means I can reach and access tower from thinkpad without any problems). However, when I suspend thinkpad (for a longer time, at least an hour or so), tower becomes unreachable, which means I can't even ping tower from thinkpad (I get 'host unreachable'). ssh gives 'no route to host'. I can ping the gateway and otherwise the connection on both machines is perfectly fine (I can browse the interwebs, etc.). The curious part is though, that as soon as I ping thinkpad from tower everything is OK again (! yes, I've tried this multiple times). Now I don't want to get up every time I want to access tower to ping thinkpad first after a suspended period, so any help would be greatly appreciated. Of course, I've done my share of googling but this one's obviously out of my reach.
I honestly don't know if this issue is wireless specific. Unfortunately, I can't use cables where I live. Maybe this post should be moved to 'Networking'.
Naturally, in case more (specific) information is needed, I'd be more than willing to provide it.
Best regards,
Stijn
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Weird (wireless) connectivity issue
Please don't cross post
Duplicate post deleted
Duplicate post deleted
Re: Weird (wireless) connectivity issue
Yeah I figured this is not specific to LMDE since I had the same issue on Ubuntu (10.04). Let's see where this goes then...Oscar799 wrote:Please don't cross post
Duplicate post deleted
Re: Weird (wireless) connectivity issue
This is a REALLY awkward situation! If any, I would expect problems on the laptop, not the server!?
No expert, but educated guess would be the router is at fault here, causing havoc with a bad routing-table (initiated by the laptop shutting down?) or something like that...
As you've already troubleshooted the situation, you could circumvent this problem by creating a tiny script on the server and run it every x seconds while it's in runlevel 2 to 5 (multiuser with or without GUI), which will automatically start at boot.
Create a script somewhere on the system, say /opt/pinglaptop.sh, with the following content:
create a file in /etc/init.d, say pinglaptop, with the following content:
give the files execution-rights:
Now create a couple of links to that last script:
Due to the letters S with digits 99, or letter K with digits 00, it will either run the script last in line with the parameter start when it enters runlevel 2 to 5, or first in line with the parameter stop when it enters runlevel 0 (shutdown), 6 (reboot) or 1 (single user mode). Why they didn't just call the parameter kill, I do not know ^^
Regards,
Anakin
No expert, but educated guess would be the router is at fault here, causing havoc with a bad routing-table (initiated by the laptop shutting down?) or something like that...
As you've already troubleshooted the situation, you could circumvent this problem by creating a tiny script on the server and run it every x seconds while it's in runlevel 2 to 5 (multiuser with or without GUI), which will automatically start at boot.
Create a script somewhere on the system, say /opt/pinglaptop.sh, with the following content:
Code: Select all
#!/bin/sh
while true
do
ping -c 1 192.168.1.102
sleep 10
done
Code: Select all
#!/bin/sh
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/opt/pinglaptop.sh
DESC="Ping laptop to keep connection open"
NAME="pinglaptop"
PIDFILE=/var/run/pinglaptop.pid
test -x ${DAEMON} || exit 0
case "$1" in
start) log_daemon_msg "Starting" "$NAME"
${DAEMON} &
ps -ef | grep ${DAEMON} | grep -v grep |awk '{ print $2 }' > "${PIDFILE}"
log_end_msg $?
;;
stop) log_daemon_msg "Stopping" "$NAME"
kill `cat ${PIDFILE}`
rm -f $PIDFILE
log_end_msg $?
;;
restart) ${0} stop
sleep 3
${0} start
;;
*) log_success_msg "Usage: ${0} {start|stop|restart}"
exit 1
esac ;;
exit 0
Code: Select all
chmod +x /etc/init.d/pinglaptop /opt/pinglaptop.sh
Code: Select all
ln -s /etc/init.d/pinglaptop /etc/rc2.d/S99pinglaptop
ln -s /etc/init.d/pinglaptop /etc/rc3.d/S99pinglaptop
ln -s /etc/init.d/pinglaptop /etc/rc4.d/S99pinglaptop
ln -s /etc/init.d/pinglaptop /etc/rc5.d/S99pinglaptop
ln -s /etc/init.d/pinglaptop /etc/rc0.d/K00pinglaptop
ln -s /etc/init.d/pinglaptop /etc/rc1.d/K00pinglaptop
ln -s /etc/init.d/pinglaptop /etc/rc6.d/K00pinglaptop
Regards,
Anakin
Re: Weird (wireless) connectivity issue
Thanks a lot Anakin! Even though I would've liked to find out what the source of the problem is, your suggestion/solution is a really good one and I will learn something by applying it 'cause some parts of it really are jibberish to me!
I had already thought of just letting the server keep pinging my laptop (at intervals of a couple of seconds, -i) but that just seems silly...
I'm gonna try this and let all of us know how it worked out later.
Best regards,
Stijn
I had already thought of just letting the server keep pinging my laptop (at intervals of a couple of seconds, -i) but that just seems silly...
I'm gonna try this and let all of us know how it worked out later.
Best regards,
Stijn
Re: Weird (wireless) connectivity issue
OK, this has completely solved my connectivity issues. Thnx again, Anakin!
Re: Weird (wireless) connectivity issue
If you can tell what seems jibberish, maybe we can explain?5oak wrote:Thanks a lot Anakin! Even though I would've liked to find out what the source of the problem is, your suggestion/solution is a really good one and I will learn something by applying it 'cause some parts of it really are jibberish to me!
Same solution, however it would require you to restart the ping manually after a reboot of the server5oak wrote:I had already thought of just letting the server keep pinging my laptop (at intervals of a couple of seconds, -i) but that just seems silly...
Sweet!5oak wrote:OK, this has completely solved my connectivity issues. Thnx again, Anakin!
Glad to have been of help
Re: Weird (wireless) connectivity issue [solved]
Well, since you ask for it, let me give some examples :Anakinholland wrote: If you can tell what seems jibberish, maybe we can explain?
- "while true" --> (while what is true?)
- why the 'do' and 'sleep 10' parts?
- don't let me start on the file in /etc/init.d
Actually, I managed to do this automatically bij running the following command on startup:Anakinholland wrote:Same solution, however it would require you to restart the ping manually after a reboot of the server
Code: Select all
sh -c "ping -i 2 192.168.1.102"
Damnit, turned out your suggestion couldn't terminate the bug after all. I know why, too: the problem occurs when my laptop has been in suspended mode, turned off or is when it's rebooted. So the problem doesn't occur when the server suspends, is turned off or rebooted. Seems like I terminated it eventually by applying the pinging workaround I described above.5oak wrote:Sweet!
Re: Weird (wireless) connectivity issue [solved]
ad 1 & 2) while is a statement, part of the bash-shell. It uses a condition to determine whether or not it should 'do' something or not. The condition could be that the day is before noon5oak wrote:Well, since you ask for it, let me give some examples :
- "while true" --> (while what is true?)
- why the 'do' and 'sleep 10' parts?
- don't let me start on the file in /etc/init.d
Code: Select all
[ `date +%H%M` -lt 1200 ]
Code: Select all
[ `ls | wc -l` -gt 10 ]
If however you want something to run indefinitely (until you kill it, or press Ctrl+C) you will need something that will always be true. So you could use
Code: Select all
[ 1 = 1 ]
Code: Select all
[ `uname` = "Linux" ]
More examples can be found here.
As with the condition "true", the programmer decided that whatever needs doing needs to be located between the words "do" and "done". After every cycle (ie. reaching the word "done") it will check if the condition is still true. If it is, it will enter the next cycle. If it isn't, it will stop the cycle there and continue downwards.
For us there is no reason why, it just needs to be done, else the loop will not function. The same goes for the if-statement. if needs a condition and when it is met, "then" do A, "else" do B, and end the statement with the word "fi". This also goes for the case-statement. It tests a condition to a list of predefined option, and ends with the word "esac".
Regarding "sleep 10", you don't need to have the server ping you laptop ALL the time, so why not reserve resources and only do it once every 10 seconds? More information can be found using the command
Code: Select all
man sleep
ad 3) the file in /etc/init.d is there to jumpstart our own script. All the files in that directory are run by the very first process that is started at boot: init
You can look it up using "ps -ef":
root 1 0 0 10:19 ? 00:00:00 /sbin/init
For that script I just picked another file that was already there, and altered it.
"start" will start the script, make note of its Process ID (PID) and jolt a line of logging in the syslog file (located in /var/log).
"stop" will kill the script, using the PID which was noted during "start", and jolt a line of logging in the syslog file (located in /var/log).
"restart" will perform a "stop", wait for 3 seconds, and then "start" again.
Any other parameter used with that script will result in an error telling the user what command/parameter he should be using.
I don't get that, as my setup (although overly extensive, I agree) should do exactly the same as yours Ah well, don't want to discuss that any further to be honest, I'm glad you got your problem solved!5oak wrote:Damnit, turned out your suggestion couldn't terminate the bug after all. I know why, too: the problem occurs when my laptop has been in suspended mode, turned off or is when it's rebooted. So the problem doesn't occur when the server suspends, is turned off or rebooted. Seems like I terminated it eventually by applying the pinging workaround I described above.