Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I am running Ubuntu Server 13.10 (Saucy) on my at home server. It connects to a wireless router using an Intel wireless PCI-express card. For the most part it works fine but occasionally I have to reboot the router and when that happens the server is no longer available through the local network until I physically reboot the server.

I've tried following the instructions from the answer to Server automatic reconnect? It makes sense. I created /usr/local/bin/check_network and chmod +xed it:

#!/bin/bash
# The router IP address.
IP_ADDRESS='192.168.3.1'
# Ping to determine if we are connected to the network.
if ! ( ping -c 1 "$IP_ADDRESS" >/dev/null 2>&1 ); then
    # If we are not connected, restart networking.
    service networking restart >/dev/null 2>&1
fi
  • NOTE: It's networking and not network according to sudo service --status-all.

I added it to root's crontab to run every minute:

* * * * * /usr/local/bin/check_network

Then I tried testing it with sudo service networking stop, but the server never becomes available on the network until reboot (as usual).

Here's the print out from sudo lshw -class network if it's any help (wlan0 is what's used):

  *-network               
       description: Wireless interface
       product: Centrino Advanced-N 6205 [Taylor Peak]
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: wlan0
       version: 34
       serial: 6c:88:14:99:1b:9c
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=3.11.0-13-generic firmware=18.168.6.1 ip=192.168.3.50 latency=0 link=yes multicast=yes wireless=IEEE 802.11abgn
       resources: irq:42 memory:fea00000-fea01fff
  *-network DISABLED
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:04:00.0
       logical name: eth0
       version: 06
       serial: bc:5f:f4:e5:a4:c5
       size: 10Mbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=2.3LK-NAPI duplex=half latency=0 link=no multicast=yes port=MII speed=10Mbit/s
       resources: irq:40 ioport:e000(size=256) memory:d0004000-d0004fff memory:d0000000-d0003fff

And here's /etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto wlan0
iface wlan0 inet dhcp
    # wireless-* options are implemented by the wireless-tools package
    wireless-mode managed
    wireless-essid MyWifi
    wireless-key1 **********

How can I get this working? I must be missing something painfully obvious. Any help would be appreciated.


Here's /var/log/syslog before I reboot the router:

Jan 17 22:10:01 caleb-srv-pons CRON[1431]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:10:31 caleb-srv-pons kernel: [  486.640712] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=118.69.206.219 DST=192.168.3.50 LEN=48 TOS=0x00 PREC=0x20 TTL=112 ID=18350 PROTO=TCP SPT=11829 DPT=5900 WINDOW=65535 RES=0x00 SYN URGP=0
Jan 17 22:10:35 caleb-srv-pons kernel: [  490.189061] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=198.252.206.25 DST=192.168.3.50 LEN=121 TOS=0x00 PREC=0x20 TTL=49 ID=50333 DF PROTO=TCP SPT=443 DPT=48715 WINDOW=36 RES=0x00 ACK PSH URGP=0
Jan 17 22:11:01 caleb-srv-pons CRON[1436]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:11:14 caleb-srv-pons kernel: [  529.312196] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=198.252.206.25 DST=192.168.3.50 LEN=121 TOS=0x00 PREC=0x20 TTL=49 ID=9328 DF PROTO=TCP SPT=443 DPT=48565 WINDOW=36 RES=0x00 ACK PSH URGP=0
Jan 17 22:12:01 caleb-srv-pons CRON[1440]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:12:35 caleb-srv-pons kernel: [  610.181844] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=198.252.206.25 DST=192.168.3.50 LEN=121 TOS=0x00 PREC=0x20 TTL=49 ID=50334 DF PROTO=TCP SPT=443 DPT=48715 WINDOW=36 RES=0x00 ACK PSH URGP=0
Jan 17 22:13:01 caleb-srv-pons CRON[1444]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:13:14 caleb-srv-pons kernel: [  649.301520] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=198.252.206.25 DST=192.168.3.50 LEN=121 TOS=0x00 PREC=0x20 TTL=49 ID=9329 DF PROTO=TCP SPT=443 DPT=48565 WINDOW=36 RES=0x00 ACK PSH URGP=0
Jan 17 22:14:01 caleb-srv-pons CRON[1448]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:14:34 caleb-srv-pons kernel: [  730.180571] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=198.252.206.25 DST=192.168.3.50 LEN=121 TOS=0x00 PREC=0x20 TTL=49 ID=50335 DF PROTO=TCP SPT=443 DPT=48715 WINDOW=36 RES=0x00 ACK PSH URGP=0
Jan 17 22:15:01 caleb-srv-pons CRON[1454]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:15:14 caleb-srv-pons kernel: [  769.300852] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=198.252.206.25 DST=192.168.3.50 LEN=121 TOS=0x00 PREC=0x20 TTL=49 ID=9330 DF PROTO=TCP SPT=443 DPT=48565 WINDOW=36 RES=0x00 ACK PSH URGP=0

Then when I reboot the router it changes to:

Jan 17 22:16:01 caleb-srv-pons CRON[1459]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:17:01 caleb-srv-pons CRON[1466]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:17:01 caleb-srv-pons CRON[1467]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.335148] cfg80211: Calling CRDA to update world regulatory domain
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.345400] cfg80211: World regulatory domain updated:
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.345416] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.345425] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.345433] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.345440] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.345447] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:17:28 caleb-srv-pons kernel: [  903.345453] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:18:01 caleb-srv-pons CRON[1475]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:18:11 caleb-srv-pons CRON[1474]: (CRON) info (No MTA installed, discarding output)
Jan 17 22:19:01 caleb-srv-pons CRON[1481]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:19:04 caleb-srv-pons CRON[1480]: (CRON) info (No MTA installed, discarding output)
Jan 17 22:20:01 caleb-srv-pons CRON[1487]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:20:04 caleb-srv-pons CRON[1486]: (CRON) info (No MTA installed, discarding output)

The repeated logs for /usr/local/bin/check_network is the minutely cronjob to check the network which is:

#!/bin/bash
# Use IP address of router.
IP_ADDRESS='192.168.3.1'
# Ping to determine if we are connected to the network.
if ! ( ping -c 1 "$IP_ADDRESS" ); then
    # If we are not connected, restart networking.
    echo 'Restart wlan0.'
    #service networking restart
    ifdown wlan0
    ifup wlan0
else
    echo 'Already connected.'
fi

And its log /root/check_network.log is like this before the router reboot:

PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.
64 bytes from 192.168.3.1: icmp_seq=1 ttl=64 time=1.88 ms

--- 192.168.3.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 1.889/1.889/1.889/0.000 ms
Already connected.
PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.
64 bytes from 192.168.3.1: icmp_seq=1 ttl=64 time=5.58 ms

--- 192.168.3.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 5.585/5.585/5.585/0.000 ms
Already connected.

And after reboot:

PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.

--- 192.168.3.1 ping statistics ---
1 packets transmitted, 0 received, 100% packet loss, time 0ms

Restart wlan0.
PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.
From 192.168.3.50 icmp_seq=1 Destination Host Unreachable

--- 192.168.3.1 ping statistics ---
1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

Restart wlan0.

And syslog behaves exactly the same whether I use ifdown and ifup, or service networking restart:

Jan 17 22:46:02 caleb-srv-pons CRON[1624]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:46:08 caleb-srv-pons kernel: [ 1212.166874] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=79.41.235.44 DST=192.168.3.50 LEN=60 TOS=0x00 PREC=0x20 TTL=49 ID=63141 DF PROTO=TCP SPT=61620 DPT=63125 WINDOW=5840 RES=0x00 SYN URGP=0
Jan 17 22:46:11 caleb-srv-pons kernel: [ 1215.184848] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=79.41.235.44 DST=192.168.3.50 LEN=60 TOS=0x00 PREC=0x20 TTL=49 ID=63142 DF PROTO=TCP SPT=61620 DPT=63125 WINDOW=5840 RES=0x00 SYN URGP=0
Jan 17 22:46:17 caleb-srv-pons kernel: [ 1221.167630] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=79.41.235.44 DST=192.168.3.50 LEN=60 TOS=0x00 PREC=0x20 TTL=49 ID=63143 DF PROTO=TCP SPT=61620 DPT=63125 WINDOW=5840 RES=0x00 SYN URGP=0
Jan 17 22:46:29 caleb-srv-pons kernel: [ 1233.166485] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=79.41.235.44 DST=192.168.3.50 LEN=60 TOS=0x00 PREC=0x20 TTL=49 ID=63144 DF PROTO=TCP SPT=61620 DPT=63125 WINDOW=5840 RES=0x00 SYN URGP=0
Jan 17 22:46:53 caleb-srv-pons kernel: [ 1257.170816] [UFW BLOCK] IN=wlan0 OUT= MAC=6c:88:14:99:1b:9c:00:25:9c:52:6a:18:08:00 SRC=79.41.235.44 DST=192.168.3.50 LEN=60 TOS=0x00 PREC=0x20 TTL=49 ID=63145 DF PROTO=TCP SPT=61620 DPT=63125 WINDOW=5840 RES=0x00 SYN URGP=0
Jan 17 22:47:01 caleb-srv-pons CRON[1629]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:48:01 caleb-srv-pons CRON[1633]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:49:01 caleb-srv-pons CRON[1637]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:50:01 caleb-srv-pons CRON[1641]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:51:01 caleb-srv-pons CRON[1645]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:52:01 caleb-srv-pons CRON[1649]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:53:01 caleb-srv-pons CRON[1654]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:54:01 caleb-srv-pons CRON[1658]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:55:01 caleb-srv-pons CRON[1662]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.584612] cfg80211: Calling CRDA to update world regulatory domain
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.594903] cfg80211: World regulatory domain updated:
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.594919] cfg80211:   (start_freq - end_freq @ bandwidth), (max_antenna_gain, max_eirp)
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.594928] cfg80211:   (2402000 KHz - 2472000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.594935] cfg80211:   (2457000 KHz - 2482000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.594943] cfg80211:   (2474000 KHz - 2494000 KHz @ 20000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.594950] cfg80211:   (5170000 KHz - 5250000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:55:12 caleb-srv-pons kernel: [ 1755.594957] cfg80211:   (5735000 KHz - 5835000 KHz @ 40000 KHz), (300 mBi, 2000 mBm)
Jan 17 22:56:01 caleb-srv-pons CRON[1668]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
Jan 17 22:57:01 caleb-srv-pons CRON[1679]: (root) CMD (/usr/local/bin/check_network >> /root/check_network.log)
share|improve this question
    
Why is it disconnecting? Are there any clues here? cat /var/log/syslog | grep - iwl -e 80211. Any, perhaps, probe response issues? –  chili555 Jan 16 at 16:51
    
@chili555 I added the results of syslog to the question. –  cpburnz Jan 18 at 4:08
    
Do you believe the disconnect occurs because the router is not operating as expected or the wireless card? I see no evidence of any disconnects in your logs. –  chili555 Jan 18 at 15:25
    
@chili555 I suspect that the wireless card does not realize the connection needs to be re-established because my Ubuntu 13.04 laptop and another 13.10 laptop handle the event perfectly fine. –  cpburnz Jan 20 at 4:03

1 Answer 1

I am a Ubuntu novice and much of what you printed here is Greek to me but I had a similar problem with 13.10 (Saucy). Beat myself up substantially to get it to reconnect when connection dropped when the wireless source decided to quit for a while, which it does from time to time since it comes from a Verizon tablet that is used for other things as well.

I use a Belkin USB wireless connector in my computer. I found if I just unplugged it, waited a bit and plugged it back in it would find the wireless signal and reconnect and I could continue as before. No reboot, no stopping or starting services or anything.

Hope that's helpful.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.