# Wireless network stops working



## smg628 (May 24, 2015)

Hi everyone,
Lately I've installed FreeBSD 10.1-RELEASE-p5 on my home mini-server, and everything works fine but for my wireless network (wlan0, HostAP), wired network (em0) seems to be ok. The WLAN works but after some time (couple hours) I cannot connect to it, if I restart the interface it works fine, but after another couple of hours issue occurs again. My configuration below:

/etc/rc.conf (only important entries)

```
ifconfig_em0="DHCP"
hostapd_enable="YES"
wlans_ath0="wlan0"
create_args_wlan0="wlanmode hostap"
ifconfig_wlan0="inet 192.168.100.1 netmask 255.255.255.0 ssid my_network_name mode 11ng channel 1"
defaultrouter="192.168.1.1"
static_routes="wlan"
route_wlan="-net 192.168.100.0/24 192.168.1.1"
gateway_enable="YES"
sshd_enable="YES"
linux_enable="YES"
dhcpd_enable="YES"
dhcpd_ifaces="wlan0"

#firewall & nat
pf_enable="YES"
pflog_enable="YES"
natd_enable="YES"
natd_interface="wlan0"
natd_flags="-dynamic -m"
```

/etc/hostap.conf

```
interface=wlan0
debug=1
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=my_network_name
wpa=1
wpa_passphrase=my_password
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
```

`ifconfig`

```
em0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=4219b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4,WOL_MAGIC,VLAN_HWTSO>
    ether 00:22:4d:86:8e:27
    inet 192.168.1.12 netmask 0xffffff00 broadcast 192.168.1.255
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
ath0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
    ether 14:cc:20:49:94:1c
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
    media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
    status: running
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
    inet 127.0.0.1 netmask 0xff000000
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
    ether 14:cc:20:49:94:1c
    inet 192.168.100.1 netmask 0xffffff00 broadcast 192.168.100.255
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
    media: IEEE 802.11 Wireless Ethernet autoselect mode 11ng <hostap>
    status: running
    ssid my_network_name channel 1 (2412 MHz 11g ht/40+) bssid 14:cc:20:49:94:1c
    regdomain 32924 country CN indoor ecm authmode WPA privacy MIXED
    deftxkey 3 AES-CCM 2:128-bit AES-CCM 3:128-bit txpower 20 scanvalid 60
    protmode CTS ampdulimit 64k ampdudensity 8 shortgi wme burst
    dtimperiod 1 -dfs
pflog0: flags=141<UP,RUNNING,PROMISC> metric 0 mtu 33160
```

Any ideas? Because for now works only `/etc/rc.d/netif restart wlan0` or rebooting server?


----------



## gentoobob (May 27, 2015)

On this PC with wlan0, why are you configuring HostAP?  If you are simply connecting to your home Wifi, you do not need this.  
Everything you need to know about wireless is here...https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/network-wireless.html
Take away your HostAP configuration, thats not needed.  And on that link, follow the WPA-PSK setup section.  I'm sure you are probably using WPA on your home wifi.


----------



## smg628 (May 27, 2015)

Thank you for replay,
All the configuration I pasted is from my mini-server, wlan0 in HostAP mode is my "wireless" router. By saying I couldn't connect to it I meant situation when after couple of hours I couldn't connect to my mini-server from client devices like my laptop, cell phones etc.


----------



## gentoobob (May 28, 2015)

Hey, no problem.  So you were making your own wireless router.  Check this guys setup out, might help.  http://blog.khubla.com/freebsd/building-my-own-wireless-point


----------

