# No route to host FreeBSD 10



## 2trill2spill (Jun 6, 2014)

I was using a couple day old install of FreeBSD 10, I turned on pf and couldn't update ports, fine I instantly realized pf was blocking it and would update the rules later. So I edited /etc/rc.conf so pf_enable was set to NO and I used to `pfctl -d` turn off pf. But When I go to install libdispatch or anything else I get no address record. Which I though meant my DNS/name servers were wrong, so i edited /etc/resolv.conf and replaced the (valid) Comcast DNS servers with 198.46.156.50
107.150.40.234, the local openNIC DNS servers. Still get no address record. So I ping google with ping 8.8.8.8 and get...


```
PING 8.8.8.8 (8.8.8.8): 56 data bytes
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
^Xping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
ping: sendto: No route to host
^C
--- 8.8.8.8 ping statistics ---
16 packets transmitted, 0 packets received, 100.0% packet loss
```
i know the ethernet cable works because i plugged it in to my laptop and I get internet. So i restarted the the modem and the router and the switch and still get no route to host.

Here is the output of `ifconfig`:

```
AN_HWTSO,LINKSTATE>
	ether 3c:07:54:47:c3:02
	inet6 fe80::3e07:54ff:fe47:c302%bge0 prefixlen 64 scopeid 0x1 
	inet 10.1.10.13 netmask 0xffffff00 broadcast 10.1.10.255 
	nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
	media: Ethernet autoselect (1000baseT <full-duplex>)
	status: active
ath0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 2290
	ether 04:54:53:06:72:64
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
	media: IEEE 802.11 Wireless Ethernet autoselect (autoselect)
	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 0x3 
	inet 127.0.0.1 netmask 0xff000000 
	nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
```

I restarted the FreeBSD box to see if that worked and it didn't, and I can still ssh into the FreeBSD box so doesn't that mean the networking is at least partially working? But any help would be appreciated to get the networking back going, thanks in advance.


----------



## usdmatt (Jun 6, 2014)

Seems like a problem with the default gateway.

What does /etc/rc.conf look like and what is the output of `netstat -rn`


----------



## 2trill2spill (Jun 6, 2014)

/etc/rc.conf

```
#set host name
hostname="Valhalla"

#static ip configuration
ifconfig_bge0="10.1.10.13 netmask 255.255.255.0"

#ssh login cause we need remote adminastration
sshd_enable="YES"

#start time servers
ntpd_enable="YES"

#pf firewall options
pf_enable="NO"
pflog_enable="NO"

#dynamic cpu clock rate
powerd_enable="YES"

# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"

#zfs because we live in the 21 century
zfs_enable="YES"

#screen saver options
blanktime="300"
saver="daemon"
```

And `netstat -rn`:

```
Internet:
Destination        Gateway            Flags    Refs      Use  Netif Expire
10.1.10.0/24       link#1             U           0      695   bge0
10.1.10.13         link#1             UHS         0        0    lo0
127.0.0.1          link#3             UH          0        0    lo0

Internet6:
Destination                       Gateway                       Flags      Netif Expire
::/96                             ::1                           UGRS        lo0
::1                               link#3                        UH          lo0
::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
fe80::/10                         ::1                           UGRS        lo0
fe80::%bge0/64                    link#1                        U          bge0
fe80::3e07:54ff:fe47:c302%bge0    link#1                        UHS         lo0
fe80::%lo0/64                     link#3                        U           lo0
fe80::1%lo0                       link#3                        UHS         lo0
ff01::%bge0/32                    fe80::3e07:54ff:fe47:c302%bge0 U          bge0
ff01::%lo0/32                     ::1                           U           lo0
ff02::/16                         ::1                           UGRS        lo0
ff02::%bge0/32                    fe80::3e07:54ff:fe47:c302%bge0 U          bge0
ff02::%lo0/32                     ::1                           U           lo0
```


----------



## kpa (Jun 6, 2014)

You're missing the default gateway setting, it has to be given manually if you're not using DHCP. For example:


```
defaultrouter="10.1.10.1"
```

Assuming 10.1.10.1 is the default gateway for your network.

Ps. Format your posts before the mods do that for you.


----------



## 2trill2spill (Jun 6, 2014)

Cool, how come that worked before I enabled pf for the first time because I had been using a static IP for a day prior, was it because I was using DHCP until it got rebooted and then DHCP was turned off?


----------



## kpa (Jun 6, 2014)

It's the ifconfig_X line that turns DHCP on or off. If it contains the DCHP keyword then DHCP is used for IP address and gateway (and few other things like nameservers in /etc/resolv.conf), otherwise IP address and gateway have to be manually configured.


----------

