# ifconfig wlan0  status:associated  inet IP acquired, but still can not ping through



## freeink (Nov 18, 2019)

FreeBSD Wireless Networking  iwn0  can not work,  Check wireless Router side RX have big traffic, TX have few traffic
It is a internal  Intel WiFi link 5300 inside ThinkPad T400 When I ping www.bing.com
send_packet: Host is down,  
Host name lookup failure

I have done the same thing followed by the video  



_View: https://www.youtube.com/watch?v=9sDBh-thPBQ_

sysctl net.wlan.devices------> net.wlan.devices:iwn0

put below in rc.conf
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"
and also put password in  etc/WPA_supplicant.conf


----------



## userxbw (Nov 19, 2019)

try pinging yahoo.com


```
userx@slackplusefi.ed.org:~
$ ping www.bing.com
PING dual-a-0001.a-msedge.net (204.79.197.200) 56(84) bytes of data.
^C
--- dual-a-0001.a-msedge.net ping statistics ---
5 packets transmitted, 0 received, 100% packet loss, time 4104ms
```

I cannot ping bing either on slack even. (Linux)


----------



## Phishfry (Nov 19, 2019)

The video you show is for an Atheros wireless module.
For Intel Wifi you need these additional settings to load firmware:
/boot/loader.conf

```
if_iwn_load="YES"
iwn4965fw_load="YES"
iwn1000fw_load="YES"
iwn5000fw_load="YES"
iwn5150fw_load="YES"
iwn6000fw_load="YES"
iwn6000g2afw_load="YES"
iwn6000g2bfw_load="YES"
iwn6050fw_load="YES"
```
The manual has all the details.





						iwn(4)
					






					www.freebsd.org


----------



## freeink (Nov 20, 2019)

Thanks Phishfry,  I tried to add, but still not work. 

```
iwn0: iwn_read_firmware: ucode rev=0x12a80601
```
Is that an error message?


----------



## ljboiler (Nov 20, 2019)

"Host name lookup failure" in the picture in the original post is a more likely a DNS configuration error.

Can you ping an IP, like `ping 8.8.8.8`?
What does /etc/resolv.conf have in it?
What does `netstat -rn` show?


----------



## freeink (Nov 20, 2019)

Before I edit resolv.conf: (almost empty conf file )    If I ping 8.8.8.8  will show this -----> "92 bytes from 192.168.41.1 destination Port Unreachable"
after I add two lines  below  then ping through 8.8.8.8 successfully,but still can't reach bing or yahoo
nameserver  61.177.7.1
nameserver   114.114.114.114

192.168.125.1 is the WLAN router Gateway , 192.168.125.117 is the acquired IP.


----------



## freeink (Nov 20, 2019)

"man resolv.conf"  find the configuration options are :  nameserver, domain,search,sortlist
add a line "search 192.168.125.1 "  finally solved problem. Thanks ljboiler and Phishfry.
But when I move from one hotel to another, the wireless router gateway would be different.
I need edit  "/etc/resolv.conf"every time when connected to different router?


----------



## SirDice (Nov 21, 2019)

Unplug em0 when you're testing your wireless. Both interfaces appear to use DHCP and are on different networks. Your default gateway probably keeps bouncing between a gateway on em0 and the gateway for wlan0 due to DHCP. Same with your DNS settings. Which is why it sometimes works and sometimes doesn't.



freeink said:


> add a line "search 192.168.125.1 " finally solved problem.


That's actually an error, I'm fairly certain adding errors doesn't solve anything.

I would suggest to stop editing /etc/resolv.conf, if DHCP is set up correctly there is no need to edit it manually. Fix your connection issues first, if there's no good network connection DNS resolving is never going to work, so focus on plain IP connectivity first. 

Steps you should test, in order:

 unplug your wired interface!
 Get a correct IP address on the wireless interface (DHCP; `ifconfig wlan0`)
 Check routing for a good default gateway (`netstat -rn`)
 Make sure you can ping the gateway
 Ping beyond the gateway, like 8.8.8.8
 Now you can check and/or fix name resolving


----------



## freeink (Nov 23, 2019)

This is a ThinkPad T420s worked,no problem.

I did the same thing on another T400 but /etc/resolv.conf file always reset (overwrite) by system. I can not save it.


----------



## Phishfry (Nov 24, 2019)

I have a feeling that your dhcp settings in your upstream wireless router are not correct.
/etc/resolv.conf file is populated by resolvconf (the service)
These settings are extracted from your upstream dhcp server.
The line "search 192.168.125.1" should be sent as an 'option' from your dhcp server. Which the resolveconf service handles.

Option 119 is domain search. With dnsmasq as my DNS/DHCP server I use localdomain as the search provider.








						a script for converting domain names to DHCP Option 119 (Domain Search Option)
					

a script for converting domain names to DHCP Option 119 (Domain Search Option) - dhcp_option119.py




					gist.github.com
				











						What does "search localdomain" do in resolv.conf?
					

When connecting to the Internet by default I get two lines in my /etc/resolv.conf file: search localdomain nameserver {ipofmyrouter} I'd like to know what exactly "search localdomain" means there...




					unix.stackexchange.com


----------

