# Ping : Host name lookup failure



## Abhid (Mar 7, 2018)

I'm a new user of FreeBSD. This appears to be a very basic question, and I've indeed read many other posts here to solve similar problems, but couldn't extract a solution.

I installed FreeBSD 11.1 via a DVD iso image. During installation, I manually entered the IPV4 address, subnet masks and DNS server addresses, by referring to my ISP service provider's data. I did not enter the IPv6 details.

Now when I ping any site like google.com, I get a message :

`cannot resolve www.google.com: Host name lookup failure`

The following are the contents of my /etc/rc.conf


```
hostname="freebsd.rooty"
ifconfig_re0="inet 192.168.1.10 netmask 255.255.255.0"
defaultrouter="192.168.1.1"
sshd_enable="YES"
dumpdev="AUTO"
```

/etc/resolv.conf has the entries of search and the 2 IPv4 DNS servers (provided by my ISP).

Output of `ifconfig` has these 2 "wrong-looking" entries apart from other entries:


```
media: Ethernet autoselect(none)
status: no carrier
```

Also, when I reboot after shutting down, the BIOS does a "hardware check" which passes successfully. Then I get some messages, the last one of which is 

```
Media Test failure. Check cable
```
Till yesterday, before installing FreeBSD, my brand new Dell Inspiron was running Ubuntu, and the Wi-Fi worked properly.


----------



## ShelLuser (Mar 7, 2018)

What _exactly_ is in /etc/resolv.conf? Because that's what's causing these issues, double check that the used syntax is correct.

(edit) It needs something such as:


```
search <domain name>
nameserver <ip addresss>
```
Where 'search' is entirely optional. See also `man resolv.conf` aka resolv.conf(5).

Also, you say it has 2 wrong looking entries but that's really not enough information to disect this. Give us the full output from `ifconfig` instead.

What happens if you try to ping 192.168.1.1?


----------



## SirDice (Mar 7, 2018)

"no carrier" means you haven't connected the network cable. Make sure you actually have a working network connection. Ping the default gateway by IP address. Make sure that works first.


----------



## Abhid (Mar 7, 2018)

ShelLuser said:


> What _exactly_ is in /etc/resolv.conf? Because that's what's causing these issues, double check that the used syntax is correct.
> 
> (edit) It needs something such as:
> 
> ...


Thanks for replying, ShelLuser. The output of /etc/resolve.conf is below:


```
search google.com
nameserver 59.185.0.23
nameserver 59.185.0.50
```

I hope the syntax is correct.


> Also, you say it has 2 wrong looking entries but that's really not enough information to disect this. Give us the full output from `ifconfig` instead.


The full output of `ifconfig` is


```
re0 flags=8843<UP, BROADCASR, RUNNING, SIMPLEX, MULTICAST> metric 0 mtu 1500
options=8209b<RXCSUM, TXCSUM, VLAN_MTU, VLAN_HWTAGGING, VLAN_HWCSUM, WOL_MAGIC,
LINKSTATE>
    ether 10:7d:1a:39:31:54
    hwaddr 10:7d:1a:39:31:54
    inet 192.168.1.10 netmask 0xffffff00 broadcast 12.168.1.255
    nd6 options=29<PERFORMNUD, IFDISABLED, AUTO_LINKLOCAL>
    media: Ethernet autoselect (none)
    status: no carrier
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 0x2
    inet 127.0.0.1 netmask 0xff000000
    nd6 options=21<PERFORMNUD, AUTO_LINKLOCAL>
    groups: lo
```



> What happens if you try to ping 192.168.1.1


The response is below:

```
ping: sendto: No route to host
ping: sendto: No route to host
.
.
```
I think something is wrong here too. But when I ping `192.168.1.10`, I get a reply of 64 bytes.


----------



## Abhid (Mar 7, 2018)

SirDice said:


> "no carrier" means you haven't connected the network cable. Make sure you actually have a working network connection. Ping the default gateway by IP address. Make sure that works first.


Hello SirDice. Actually, I'm using Realtek's Wi-Fi modem. Previously, before installing FreeBSD on my entire harddisc, it was working on the Ubuntu installation. Are some additional settings needed to make FreeBSD "recognize" the Wi-Fi modem ?

Pinging the default_router gives `No route to host.` But when I ping IP address of ifconfig_re0, I get a reply of 64 Bytes.


----------



## SirDice (Mar 7, 2018)

Abhid said:


> Realtek's Wi-Fi modem


I'm just being a bit pedantic but that's not a modem, it's a network device. Wifi modems don't exist. 



Abhid said:


> Pinging the default_router gives "No route to host".


That means you don't have a network connection. Fix that first. 



Abhid said:


> But when I ping IP address of ifconfig_re0, I get a reply of 64 Bytes.


You're pinging yourself, I would be very surprised if that didn't work.


----------



## Abhid (Mar 7, 2018)

SirDice said:


> I'm just being a bit pedantic but that's not a modem, it's a network device. Wifi modems don't exist.
> 
> That means you don't have a network connection. Fix that first.


Well, I'm able to access the internet through other devices on the same Wi-Fi network. Besides, the Wi-Fi network device i.e. Realtek was indeed able to access the internet (when Ubuntu was installed) before I erased the entire harddisc and installed FreeBSD. Realtek was detected in the installation phase and I just input the IPv4 DNS addresses and the Subnet mask, and local IP.


----------



## SirDice (Mar 7, 2018)

Abhid said:


> Well, I'm able to access the internet through other devices on the same Wi-Fi network.


That only proves that the Wifi network itself works. It doesn't mean your FreeBSD machine is connected to that network. 


Abhid said:


> Realtek was detected in the installation phase and I just input the IPv4 DNS addresses and the Subnet mask, and local IP.


Wireless networks also require an SSID and a WPA key. I'm guessing you managed to configure your _wired_ connection, not your _wireless_. The re(4) interface is a _wired_ ethernet interface.


----------



## Abhid (Mar 7, 2018)

SirDice said:


> That only proves that the Wifi network itself works. It doesn't mean your FreeBSD machine is connected to that network.
> 
> Wireless networks also require an SSID and a WPA key. I'm guessing you managed to configure your _wired_ connection, not your _wireless_. The re(4) interface is a _wired_ ethernet interface.


OK. I'll see how to configure the SSID and WPA keys. Actually, I just followed the instructions in the FreeBSD installation manual. I don't know where it went wrong.


----------



## SirDice (Mar 7, 2018)

Probably because Realtek makes both types of cards and you didn't notice it was actually the _wired_ Realtek interface you configured, not the _wireless_ Realtek interface. 

Not a big issue, I generally prefer to configure wireless interfaces after the installation has finished. Wired networks are typically easier to configure during the installation. Just plug in the ethernet cable, update your system, then look into configuring the wireless interface. 

Handbook: 30.3. Wireless Networking


----------



## Abhid (Mar 20, 2018)

Thanks for that, SirDice. Posting this from my FreeBSD installation now, albeit with the wired connection (had to move the router and wires from one room to another).

Just to get some other lost person started once internet has been started after the bare installation:


Create / Edit this file: `/usr/local/etc/pkg/FreeBSD.conf` with these contents:


```
FreeBSD: {
  url: "pkg+http://pkg.FreeBSD.org/${ABI}/latest",
  mirror_type: "srv",
  signature_type: "fingerprints",
  fingerprints: "/usr/share/keys/pkg",
  enabled: yes
}
```

     2. Install ffmpeg package. This seems to be a very important package.

     3. Then install a GUI like xfce or KDE or GNOME (I installed xfce as it's lightweight)

     4. Then install Firefox or Chrome. Note: Installing by ports takes *12 hours.* Pkg installation should be much much faster.

     5. Then install a PDF reader like Xpdf, and a Power manager (Xfce-power manager). Just google how to install these on FreeBSD.

Thanks.


----------

