# Static routes mess up network



## fuhdan (Feb 23, 2015)

Hi all
When add static routes to the rc.conf, then the whole routing is messed up. There is no DNS working, nothing.
I add the following lines to the rc.conf file:


```
hostname="sy-nvla-n-008"
keymap="swissgerman.iso.acc.kbd"

# Configure Interface
ifconfig_de0="inet 217.192.x.x netmask 255.255.255.192"
defaultrouter="217.192.x.y"

# Set static routes
static_routes="net1 net2"
route_net1="-net 192.168.100.0/24 217.192.x.z"
route_net2="-net 10.253.24.0/22 217.192.x.z"
```

If I comment the static routes out, everything works fine. Also if I add the static routes after the boot manually:
`route add -net 192.168.100.0/24 217.192.x.z
route add -net 10.253.24.0/22 217.192.x.z`

My system is:

```
FreeBSD sy-nvla-n-008 10.1-RELEASE FreeBSD 10.1-RELEASE #0 r274401: Tue Nov 11 21:02:49 UTC 2014     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/sys/GENERIC  amd64
```
What do I miss here?

Thanks for your help

Cheers Daniel


----------



## usdmatt (Feb 23, 2015)

What does the routing table look like (`netstat -rn`) when the routes are added and things stop working.


----------



## phoenix (Feb 24, 2015)

Why are you adding static routes to the default gateway?

You generally add static routes for things that don't go through the default gateway.


----------



## fuhdan (Feb 28, 2015)

I did several test now. The problem is not the static route.
The problem is, that after the boot, I have not network connection. `netstat -r` shows me all routes and network configs. I can ping my interface. But nothing else. Even not the hosts in the same subnet. After restarting the network (`/etc/rc.d/netif restart`) and routing (`/etc/rc.d/routing restart`), everything works as expected.
I run FreeBSD on Hyper-V 2012R2.


----------



## drummondislebsd (Mar 1, 2015)

If you can successfully ping yourself, I suspect a nameserver issue.
verify you have a valid entries like these in resolv.conf


```
search example.com #[DEL]google.com[/DEL] -- MOD (just an example, don't use Google--use your local LAN)
nameserver 8.8.8.8
[DEL]nameserver 123.456.789[/DEL] # MOD (not a correct IP)
```


----------



## fuhdan (Mar 3, 2015)

Hi
Thanks for the reply. But it's not a DNS issue. I can't ping the hosts in the same subnet with the IP address. I assume, there is an issue with the network driver. The network is just 100MBit full duplex. The Hyper-V Switch supports 10GBit full.
In the folder /boot/kernel, I have the hv_* drivers. But in the /boot/loader.conf file, It's nothing in.
Do I have to load all drivers? Or can I just load the network driver? Is that the hv_netvsc_load?

My network card is also set to 100baseTX instead of 1000baseTX or even 10GBit (which is supported by the hyper-v server).

I upgraded the system:

```
FreeBSD sy-nvla-n-008 10.1-RELEASE-p6 FreeBSD 10.1-RELEASE-p6 #0: Tue Feb 24 19:00:21 UTC 2015  root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------

