# netifrc + wlan + dhcp + static route

## Uli-DD-70

Hello,

my box is configured to use wlan via wpa_supplicant using dhcp. On my dhcp-server there is an entry for one static route (host route via gateway).

Problem: The netifrc scripts on client side do not add this given static route as a host-route; the routing table shows a route without gateway address.

Btw., dhcpd gives the right data when asking my dhcp-server.

This problem occures since an update this summer, I don't know anymore which packages are new, think about dhcpd or wpa_supplicant.

Here's server's dhcpd.conf:

```

default-lease-time 3600;        # 1 hour

max-lease-time 259200;          # 3 days

option rfc3442-classless-static-routes code 121 = array of integer 8;

option ms-classless-static-routes code 249 = array of integer 8;

option domain-name "xxx.xxx";

option domain-name-servers 10.0.0.1;

option broadcast-address 192.168.178.255;

option routers 192.168.178.1;

option subnet-mask 255.255.255.0;

option static-routes 10.0.0.1 192.168.178.6;

subnet 192.168.178.0 netmask 255.255.255.0

  {

   range 192.168.178.20 192.168.178.199;

  }

```

Here's the response from dhcpd on my client when starting interface wlan0:

 *Quote:*   

> 
> 
> Nov 15 00:52:03 aphrodite dhcpcd[6076]: wlan0: carrier acquired
> 
> Nov 15 00:52:03 aphrodite dhcpcd[6076]: wlan0: IAID 5d:7c:0d:88
> ...

 

As you can see, dhcpd tells the right host route via the right interface

But the resulting kernel routing table looks like this:

 *Quote:*   

> 
> 
> ip route list
> 
> default via 192.168.178.1 dev wlan0  metric 302
> ...

 

If I manually run this:

 *Quote:*   

> 
> 
> ip route add 10.0.0.1 via 192.168.178.6
> 
> 

 

it works and I can ping the 10.0.0.1!!!

Routing table like this:

 *Quote:*   

> 
> 
> ip route list
> 
> default via 192.168.178.1 dev wlan0  metric 302 
> ...

 

Can someone tell me, why the host route is not added correctly?

Thank You for your help, Uli

----------

## UberLord

Looks like a bug with dhcpcd to me!

```
Nov 15 00:52:04 aphrodite dhcpcd[6076]: wlan0: adding default route via 192.168.178.1

Nov 15 00:52:04 aphrodite dhcpcd[6076]: wlan0: removing route to 192.168.178.0/24 
```

That by itself is a problem.

What dhcpcd version are you running? If not 6.9.3, could you try upgrading please?

If you are running 6.9.3, can you try the 9999 ebuild to see if it's already fixed?

----------

## Uli-DD-70

My dhcpcd was 6.9.0. I've tried both 6.9.3 and 9999. No difference... 

Btw.: The message "dhcpcd[6076]: wlan0: removing route to 192.168.178.0/24" looks like a problem, but my routing table still has an entry for that route:

 *Quote:*   

> 
> 
> default via 192.168.178.1 dev wlan0 metric 302
> 
> 10.0.0.1 dev wlan0 metric 302 ---> this line is wrong, I can't ping 10.0.0.1, gateway missing
> ...

 

Problem still the host route to 10.0.0.1.

Anyone an idea?

Thanks Uli

----------

## UberLord

Yup, a bug.

I fixed it here:

http://roy.marples.name/projects/dhcpcd/info/0a516394ccc77128

and here:

http://roy.marples.name/projects/dhcpcd/info/da3590c3991d6c25

If you emerge the 9999 ebuild again it should now be fixed ..... post back here with results please!

----------

