# Internet through WLAN - no ping to gateway



## mikro (Oct 1, 2013)

Hi,

I am trying to connect to the internet with a WNIC TP-Link WN321G, which is supported by freeBSD FreeBSD. There is already an internal connection on the PC via a LAN, so I have disabled it with `ifconfig re0 down`.


```
#ifconfig run0
run0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether f8:d1:11:1b:57:9f
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)

        status: no carrier
```
From a network-wireless guide I have done:

`# ifconfig wlan0 create wlandev run0`
`# ifconfig wlan0 inet 192.168.3.44 netmask 255.255.255.0 ssid [myssidI] wepmode on weptxkey 1 wepkey 1:[password]`

And there is no ping to host 

```
# ping 192.168.3.1
PING 192.168.3.1 (192.168.3.1): 56 data bytes
ping: sendto: Host is down
ping: sendto: Host is down
```

Bringing up the interface with `#service netif start` shows the same error.


----------



## johnblue (Oct 2, 2013)

Hi Mikro.

As with all troubleshooting methods how do you know that the wireless hardware actually works?



See if it can scan for and find an access point:

`# ifconfig wlan0 create wlandev run0`
`# ifconfig wlan0 up scan`


----------



## mikro (Oct 2, 2013)

johnblue said:
			
		

> Hi Mikro.
> 
> As with all troubleshooting methods how do you know that the wireless hardware actually works?
> 
> ...



Hi Johnbue, I have no clue if the HW works. Executing commands above shows me:

`# ifconfig wlan0 create wlandev run0`
`# ifconfig wlan0 up scan`
`# ifconfig wlan0 up scan`

```
SSID/MESH ID    BSSID              CHAN RATE   S:N     INT CAPS
Anton2          94:0c:6d:ae:df:e2    1   54M -33:-55  100 EPS 
Hdtv 4516734    f8:d1:11:20:0e:38    9   54M -40:-67  100 EPS  RSN WPA WME HTCAP ATH WPS
-FAUST-         00:15:6d:3e:55:7c    2   54M -43:-73  100 EPS  RSN WME HTCAP ATH
Wi-Fi           b0:48:7a:86:74:54    3   54M -44:-75  100 EPS  WME ATH
```
The first AP is the one I am trying to connect


----------



## johnblue (Oct 2, 2013)

Excellent.  It works!  Well, it at least can see some APs.



So you're trying to connect to the TP-LINK device. Is there any particular reason why you want it to have a static IP address? Will a DHCP assigned one suffice?

I ask because if you can get an easy DHCP assignment, then you will know that the wireless card can move traffic. After that, you can work on why the static fails.


----------



## mikro (Oct 2, 2013)

Added to /etc/rc.conf:


```
wlans_run0="wlan0"
ifconfig_wlan0="DHCP"
```

Restarted machine.


```
# ifconfig
re0: flags=8802<BROADCAST,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
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
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 0x4 
        inet 127.0.0.1 netmask 0xff000000 
        nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
run0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 2290
        ether f8:d1:11:1b:57:9f
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect mode 11g
        status: associated
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether f8:d1:11:1b:57:9f
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
        status: no carrier
        ssid "" channel 1 (2412 MHz 11g)
        country US authmode OPEN privacy OFF txpower 0 bmiss 7 scanvalid 60
        protmode CTS wme bintval 0
```

Tried to connect to AP 


```
# ifconfig wlan0 ssid [I]myssid[/I] wepmode on wepkey [I]password[/I]
# ping 192.168.3.1
PING 192.168.3.1 (192.168.3.1): 56 data bytes
ping: sendto: Network is down
ping: sendto: Network is down
ping: sendto: Network is down
```


----------



## SirDice (Oct 2, 2013)

After you associated with the wireless network you need to get an IP address. 

`dhclient wlan0`


----------



## mikro (Oct 2, 2013)

```
# dhclient wlan0
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 7
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 11
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 13
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 10
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 20
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
```


----------



## mikro (Oct 2, 2013)

`dhclient` succeeds on ethernet connecting.


----------



## SirDice (Oct 2, 2013)

Are you sure the association worked? Are you using static or dynamic IP addresses? The interface must be associated and then assigned an IP address before you communicate. 

I would also suggest ditching WEP. It's broken beyond repair. I can crack _any_ WEP key in about 5 minutes. Use WPA-EAL at the very least.


----------



## mikro (Oct 2, 2013)

It is already assosiated.in /etc/rc.conf:


```
wlans_run0="wlan0"
ifconfig_wlan0="DHCP"
```

`#ifconfig wlan0 ssid myssid wepmode on wepkey mypassword`

The software of the router is a little bit old, there is no other security option except WEP. It sucks, but the purpose is to test WLAN on FreeBSD.


----------



## SirDice (Oct 2, 2013)

mikro said:
			
		

> It is already assosiated.


Not really, those commands only show how the association is done, it doesn't show if it actually succeeded. As long as you have "status: no carrier" the association didn't work.


----------



## mikro (Oct 2, 2013)

Assigned IP and netmask statically and it become associated


```
wlan0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        ether f8:d1:11:1b:57:9f
        inet 192.168.3.46 netmask 0xffffff00 broadcast 192.168.3.255
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
        media: IEEE 802.11 Wireless Ethernet OFDM/36Mbps mode 11g
        status: associated
        ssid Anton2 channel 1 (2412 MHz 11g) bssid 94:0c:6d:ae:df:e2
        country US authmode OPEN privacy ON deftxkey UNDEF wepkey 1:40-bit
        txpower 0 bmiss 7 scanvalid 60 protmode CTS wme
```


----------



## johnblue (Oct 3, 2013)

mikro said:
			
		

> Assigned IP and netmask statically and it become associated


Glad that it is working for ya Mikro!

I am a bit lost though .. did you restructure your config commands?  What did you need to do differently to get it working?


----------



## mikro (Oct 3, 2013)

Hi, all I have done

/etc/rc.conf


```
wlans_run0="wlan0"
ifconfig_wlan0="DHCP"
```
`#ifconfig wlan0 ssid myssid wepmode on wepkey mypassword`
`#ifconfig inet 192.168.3.34 netmast 255.255.255.0`
`#route add default 192.168.3.1`

Yep, I do not need to assign the inet address dynamically and statically, but when statically - the interface becomes asso*c*iated.


----------



## johnblue (Oct 3, 2013)

ugh. Something is missing from somewhere on this.


----------



## mikro (Oct 3, 2013)

johnblue said:
			
		

> Something is missing from somewhere on this.



Point me, please, what have I missed.


----------



## mikro (Oct 10, 2013)

Hi all, WLAN works with another wireless NIC. The previous wireless NIC was a TP-Link WN321G v4 but only v1 is supported. Thanks all for help!


----------



## wblock@ (Oct 10, 2013)

Good.  Now, please stop using WEP.  It is the wireless equivalent of having your password set to "password".


----------

