# [wlan AP] no internet on client, ping to gateway succeeds



## mikro (Oct 17, 2013)

Hi, there is internet on LAN re0 interface and the goal is to set WLAN AP.
Currect configuration:

/etc/hostapd.conf

```
interface=wlan0
debug=1
ctrl_interface=/var/run/hostapd
ctrl_interface_group=wheel
ssid=freebsdapp
wpa=2
wpa_passphrase=freebsdapp
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP TKIP
```
/etc/rc.conf

```
hostname="borys"
wlan_wep_load="YES"
wlan_tkip_load="YES"
wlan_ccmp_load="YES"
wlan_xauth_load="YES"
wlan_acl_load="YES"
ifconfig_re0="DHCP"
```
/usr/local/etc/dhcpd.conf

```
subnet 192.168.77.0 netmask 255.255.255.0 {
  range 192.168.77.150 192.168.77.170;
  option domain-name-servers 8.8.8.8, 8.8.4.4;
  option routers 192.168.77.1;
  option broadcast-address 192.168.77.255;
  default-lease-time 600;
  max-lease-time 7200;
}
```


```
# ifconfig wlan0 create wlandev rum0 wlanmode hostap
# ifconfig wlan0 inet 192.168.77.1 netmask 255.255.255.0
# /etc/rc.d/hostapd onerestart
Starting hostapd.
Configuration file: /etc/hostapd.conf
Using interface wlan0 with hwaddr 00:1e:58:a4:6a:30 and ssid 'freebsdapp'
# dhcpd wlan0
Internet Systems Consortium DHCP Server 4.2.4-P2
Copyright 2004-2012 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Wrote 3 leases to leases file.
Listening on BPF/wlan0/00:1e:58:a4:6a:30/192.168.77.0/24
Sending on   BPF/wlan0/00:1e:58:a4:6a:30/192.168.77.0/24
# ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=8209b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_MAGIC,LINKSTATE>
        ether 28:92:4a:2a:06:b5
        inet 192.168.19.135 netmask 0xffffff00 broadcast 192.168.19.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
pflog0: flags=0<> metric 0 mtu 33152
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
pfsync0: flags=0<> metric 0 mtu 1500
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        syncpeer: 0.0.0.0 maxupd: 128
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 0x6 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
rum0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether 00:1e:58:a4:6a:30
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether 00:1e:58:a4:6a:30
        inet 192.168.77.1 netmask 0xffffff00 broadcast 192.168.77.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g <hostap>
        status: running
        ssid freebsdapp channel 6 (2437 MHz 11g) bssid 00:1e:58:a4:6a:30
        country US authmode WPA2/802.11i privacy MIXED deftxkey 2
        TKIP 2:128-bit txpower 0 scanvalid 60 protmode CTS dtimperiod 1 -dfs
```

There is an internet connection on machine, where the AP is running. IP addresses are assigned on clients, ping to gateway `ping 192.168.77.1` succeeds, but `ping 8.8.8.8` or `ping google.com` fails.


----------



## SirDice (Oct 17, 2013)

You need to turn on routing, in /etc/rc.conf:

```
gateway_enable="YES"
```


----------



## mikro (Oct 18, 2013)

SirDice said:
			
		

> You need to turn on routing, in /etc/rc.conf:
> 
> ```
> gateway_enable="YES"
> ```



There is no effect after enabling gateway and restarting machine, internet still not working on clients.


----------



## SirDice (Oct 18, 2013)

Are you behind a router? If so you need to add a static route in it so it knows where to find the 192.168.77.0/24 network.


----------



## mikro (Oct 18, 2013)

SirDice said:
			
		

> Are you behind a router? If so you need to add a static route in it so it knows where to find the 192.168.77.0/24 network.



Do you mean to execute on client `#route add default 192.168.77.1`?


----------



## SirDice (Oct 18, 2013)

Something similar but on your router that connects you to the internet.


----------



## mikro (Oct 21, 2013)

Hi, actually there is route to gateway on the machine, that works as wireless access point.


```
# netstat -rn
Routing tables

Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
default            192.168.3.1        UGS         0      441    re0
127.0.0.1          link#6             UH          0        2    lo0
192.168.3.0/24     link#2             U           0        0    re0
192.168.3.104      link#2             UHS         0        0    lo0
```


----------



## mikro (Oct 22, 2013)

Hi, just added entry to static route on the router and it works. Thanks!


----------

