I'm trying to turn my Pi into an access point with an Edimax wifi dongle and a Huawai 3G modem for Internet access. Generally, this is working well. But under load the 3G modem sometimes disconnects. The modem comes back up, but hostapt doesn't provide the wifi anymore (clients can't see it, but the hostapd service is still running)
I followd this tutorial which includes the usage of a hostapd which is NOT from the repository because the hosted one does not work with the Edimax dongle (Realtek RTL8188CUS).
/etc/hostapd/hostapd.conf:
interface=wlan0
driver=rtl871xdrv
ssid=someSSID
hw_mode=g
channel=11
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=123456789k
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
country_code=CH
ieee80211n=1
wmm_enabled=1
This is how I figured out the 3G modem reconnect is the problem... this is in the syslog at the time wifi disconnected. You can see the modem connecting again but the access point does not come up anymore (remember, hostapd is still running though).
Apr 17 11:00:39 raspberrypi kernel: [ 4827.080303] usb 1-1-port2: over-current change
Apr 17 11:00:39 raspberrypi kernel: [ 4827.106813] rtw_cmd_thread: DriverStopped(0) SurpriseRemoved(1) break at line 482
Apr 17 11:00:39 raspberrypi pppd[20675]: Hangup (SIGHUP)
Apr 17 11:00:39 raspberrypi pppd[20675]: Connect time 3.9 minutes.
Apr 17 11:00:39 raspberrypi pppd[20675]: Sent 852294 bytes, received 23155718 bytes.
Apr 17 11:00:39 raspberrypi kernel: [ 4827.297372] usb 1-1.5: USB disconnect, device number 14
Apr 17 11:00:39 raspberrypi kernel: [ 4827.307153] option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
Apr 17 11:00:39 raspberrypi kernel: [ 4827.307225] option 1-1.5:1.0: device disconnected
Apr 17 11:00:39 raspberrypi kernel: [ 4827.307625] huawei_cdc_ncm 1-1.5:1.1 wwan0: unregister 'huawei_cdc_ncm' usb-bcm2708_usb-1.5, Huawei CDC NCM device
Apr 17 11:00:39 raspberrypi pppd[20675]: Modem hangup
Apr 17 11:00:39 raspberrypi pppd[20675]: Connection terminated.
Apr 17 11:00:39 raspberrypi kernel: [ 4827.368128] option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
Apr 17 11:00:39 raspberrypi kernel: [ 4827.368237] option 1-1.5:1.2: device disconnected
Apr 17 11:00:39 raspberrypi kernel: [ 4827.368944] option1 ttyUSB2: GSM modem (1-port) converter now disconnected from ttyUSB2
Apr 17 11:00:39 raspberrypi kernel: [ 4827.369043] option 1-1.5:1.3: device disconnected
Apr 17 11:00:39 raspberrypi kernel: [ 4827.617041] usb 1-1.2: USB disconnect, device number 12
Apr 17 11:00:39 raspberrypi kernel: [ 4827.936774] usb 1-1.2: new high-speed USB device number 15 using dwc_otg
Apr 17 11:00:40 raspberrypi kernel: [ 4828.038372] usb 1-1.2: New USB device found, idVendor=7392, idProduct=7811
Apr 17 11:00:40 raspberrypi kernel: [ 4828.038400] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Apr 17 11:00:40 raspberrypi kernel: [ 4828.038418] usb 1-1.2: Product: 802.11n WLAN Adapter
Apr 17 11:00:40 raspberrypi kernel: [ 4828.038435] usb 1-1.2: Manufacturer: Realtek
Apr 17 11:00:40 raspberrypi kernel: [ 4828.038451] usb 1-1.2: SerialNumber: 00e04c000001
Apr 17 11:00:40 raspberrypi pppd[20675]: Exit.
Apr 17 11:00:45 raspberrypi kernel: [ 4833.716759] usb 1-1.5: new high-speed USB device number 16 using dwc_otg
Apr 17 11:00:45 raspberrypi kernel: [ 4833.817917] usb 1-1.5: New USB device found, idVendor=12d1, idProduct=14fe
Apr 17 11:00:45 raspberrypi kernel: [ 4833.817948] usb 1-1.5: New USB device strings: Mfr=2, Product=1, SerialNumber=0
Apr 17 11:00:45 raspberrypi kernel: [ 4833.817966] usb 1-1.5: Product: HUAWEI Mobile
Apr 17 11:00:45 raspberrypi kernel: [ 4833.817983] usb 1-1.5: Manufacturer: HUAWEI
Apr 17 11:00:45 raspberrypi kernel: [ 4833.820619] usb-storage 1-1.5:1.0: USB Mass Storage device detected
Apr 17 11:00:45 raspberrypi kernel: [ 4833.821351] scsi host16: usb-storage 1-1.5:1.0
Apr 17 11:00:45 raspberrypi kernel: [ 4833.822616] usb-storage 1-1.5:1.1: USB Mass Storage device detected
Apr 17 11:00:45 raspberrypi kernel: [ 4833.823101] scsi host17: usb-storage 1-1.5:1.1
Apr 17 11:00:46 raspberrypi usb_modeswitch: switching device 12d1:14fe on 001/016
Apr 17 11:00:46 raspberrypi kernel: [ 4834.505447] usb 1-1.5: USB disconnect, device number 16
Apr 17 11:00:52 raspberrypi kernel: [ 4840.626889] usb 1-1.5: new high-speed USB device number 17 using dwc_otg
Apr 17 11:00:52 raspberrypi kernel: [ 4840.728090] usb 1-1.5: New USB device found, idVendor=12d1, idProduct=1506
Apr 17 11:00:52 raspberrypi kernel: [ 4840.728123] usb 1-1.5: New USB device strings: Mfr=3, Product=2, SerialNumber=0
Apr 17 11:00:52 raspberrypi kernel: [ 4840.728142] usb 1-1.5: Product: HUAWEI Mobile
Apr 17 11:00:52 raspberrypi kernel: [ 4840.728159] usb 1-1.5: Manufacturer: HUAWEI
Apr 17 11:00:52 raspberrypi kernel: [ 4840.731071] option 1-1.5:1.0: GSM modem (1-port) converter detected
Apr 17 11:00:52 raspberrypi kernel: [ 4840.731758] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB0
Apr 17 11:00:52 raspberrypi kernel: [ 4840.734656] huawei_cdc_ncm 1-1.5:1.1: MAC-Address: 58:2c:80:13:92:63
Apr 17 11:00:52 raspberrypi kernel: [ 4840.734687] huawei_cdc_ncm 1-1.5:1.1: setting rx_max = 16384
Apr 17 11:00:52 raspberrypi kernel: [ 4840.734948] huawei_cdc_ncm 1-1.5:1.1: setting tx_max = 16384
Apr 17 11:00:52 raspberrypi kernel: [ 4840.735578] huawei_cdc_ncm 1-1.5:1.1: cdc-wdm0: USB WDM device
Apr 17 11:00:52 raspberrypi kernel: [ 4840.737570] huawei_cdc_ncm 1-1.5:1.1 wwan0: register 'huawei_cdc_ncm' at usb-bcm2708_usb-1.5, Huawei CDC NCM device, 58:2c:80:13:92:63
Apr 17 11:00:52 raspberrypi kernel: [ 4840.738104] option 1-1.5:1.2: GSM modem (1-port) converter detected
Apr 17 11:00:52 raspberrypi kernel: [ 4840.738651] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB1
Apr 17 11:00:52 raspberrypi kernel: [ 4840.739354] option 1-1.5:1.3: GSM modem (1-port) converter detected
Apr 17 11:00:52 raspberrypi kernel: [ 4840.740027] usb 1-1.5: GSM modem (1-port) converter now attached to ttyUSB2
Apr 17 11:00:52 raspberrypi kernel: [ 4840.740750] usb-storage 1-1.5:1.4: USB Mass Storage device detected
Apr 17 11:00:52 raspberrypi kernel: [ 4840.741304] scsi host18: usb-storage 1-1.5:1.4
Apr 17 11:00:52 raspberrypi kernel: [ 4840.742645] usb-storage 1-1.5:1.5: USB Mass Storage device detected
Apr 17 11:00:52 raspberrypi kernel: [ 4840.743078] scsi host19: usb-storage 1-1.5:1.5
Apr 17 11:00:53 raspberrypi logger: usb_modeswitch: switched to 12d1:1506 on 001/017
Apr 17 11:00:53 raspberrypi kernel: [ 4841.738015] scsi 18:0:0:0: CD-ROM HUAWEI Mass Storage 2.31 PQ: 0 ANSI: 2
Apr 17 11:00:53 raspberrypi kernel: [ 4841.739031] scsi 19:0:0:0: Direct-Access HUAWEI SD Storage 2.31 PQ: 0 ANSI: 2
Apr 17 11:00:53 raspberrypi kernel: [ 4841.742049] sd 19:0:0:0: Attached scsi generic sg0 type 0
Apr 17 11:00:53 raspberrypi kernel: [ 4841.744344] sr 18:0:0:0: [sr0] scsi-1 drive
Apr 17 11:00:53 raspberrypi kernel: [ 4841.744946] sd 19:0:0:0: [sda] Attached SCSI removable disk
Apr 17 11:00:53 raspberrypi kernel: [ 4841.747202] sr 18:0:0:0: Attached scsi generic sg1 type 5
Apr 17 11:01:31 raspberrypi pppd[1286]: pppd options in effect:
Apr 17 11:01:31 raspberrypi pppd[1286]: -detach#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: logfd -1#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: maxfail 3#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: ktune#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: dump#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: noauth#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: name raspberrypi#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: user mobitel#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: password ??????#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: usehostname#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: /dev/ttyUSB0#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: 460800#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: lock#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: connect /usr/sbin/chat -v -f /tmp/pppd.tmp.31131#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: crtscts#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: modem#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: asyncmap 0#011#011# (from /etc/ppp/options)
Apr 17 11:01:31 raspberrypi pppd[1286]: lcp-echo-failure 4#011#011# (from /etc/ppp/options)
Apr 17 11:01:31 raspberrypi pppd[1286]: lcp-echo-interval 30#011#011# (from /etc/ppp/options)
Apr 17 11:01:31 raspberrypi pppd[1286]: hide-password#011#011# (from /etc/ppp/options)
Apr 17 11:01:31 raspberrypi pppd[1286]: noipdefault#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: defaultroute#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: usepeerdns#011#011# (from command line)
Apr 17 11:01:31 raspberrypi pppd[1286]: noipx#011#011# (from /etc/ppp/options)
Apr 17 11:01:31 raspberrypi pppd[1286]: pppd 2.4.5 started by root, uid 0
Apr 17 11:01:32 raspberrypi chat[1311]: abort on (NO CARRIER)
Apr 17 11:01:32 raspberrypi chat[1311]: abort on (NO DIALTONE)
Apr 17 11:01:32 raspberrypi chat[1311]: abort on (BUSY)
Apr 17 11:01:32 raspberrypi chat[1311]: abort on (ERROR)
Apr 17 11:01:32 raspberrypi chat[1311]: abort on (NO ANSWER)
Apr 17 11:01:32 raspberrypi chat[1311]: send (ATZ^M)
Apr 17 11:01:32 raspberrypi chat[1311]: expect (OK)
Apr 17 11:01:32 raspberrypi chat[1311]: ATZ^M^M
Apr 17 11:01:32 raspberrypi chat[1311]: OK
Apr 17 11:01:32 raspberrypi chat[1311]: -- got it
Apr 17 11:01:32 raspberrypi chat[1311]: send (ATD*99#^M)
Apr 17 11:01:32 raspberrypi pppd[1286]: Serial connection established.
Apr 17 11:01:32 raspberrypi pppd[1286]: Using interface ppp0
Apr 17 11:01:32 raspberrypi pppd[1286]: Connect: ppp0 <--> /dev/ttyUSB0
Apr 17 11:01:34 raspberrypi pppd[1286]: CHAP authentication succeeded: Welcome!!
Apr 17 11:01:34 raspberrypi pppd[1286]: CHAP authentication succeeded
Apr 17 11:01:36 raspberrypi pppd[1286]: Could not determine remote IP address: defaulting to 10.64.64.64
Apr 17 11:01:36 raspberrypi pppd[1286]: local IP address 10.155.157.243
Apr 17 11:01:36 raspberrypi pppd[1286]: remote IP address 10.64.64.64
Apr 17 11:01:36 raspberrypi pppd[1286]: primary DNS address 203.144.65.2
Apr 17 11:01:36 raspberrypi pppd[1286]: secondary DNS address 203.144.66.3
edit:
Model 2. I have to admit I use my notebook as a power supply.