# [solved] wireless static ip

## strathmeyer

So I currently have wifi working with wpa_supplicant.

My /etc/conf.d/net file looks like this:

```
modules_wlan0=( "wpa_supplicant" )

wpa_supplicant_wlan0=( "-Dwext" )

config_wlan0=( "dhcp" )

dhcp_wlan0="nontp nonis"
```

I want to use a static ip address, so I change the last two lines of /etc/conf.d/net to:

```
config_wlan0=( "192.168.1.102 broadcast 192.168.1.255 netmask 255.255.255.0" )

routes_wlan0=( "default via 192.168.1.1" )
```

If I then do a "/etc/init.d/net.wlan0 restart" with the DHCP server on the router still on the computer will connect to another network. If I correctly turn the DHCP server on the router off, then "iwconfig" says that I am connected but "ifconfig" still doesn't say that I have an ip address and when I try to ping something I get "connect: Network is unreachable". My setup works with DHCP turned on but I want to be using static ips.

I'm not really good with wifi and I don't really know where to begin diagnosing this problem. I don't understand why changing from DHCP to static IP would cause the wireless network to fail like this.

"route" will yield only the loopback line while this failure occurs.Last edited by strathmeyer on Tue Nov 20, 2007 11:31 pm; edited 1 time in total

----------

## grimm26

remove or comment  

```
config_wlan0=( "dhcp" ) 
```

 from your /etc/conf.d/net if you want a static IP for wlan0.

----------

## strathmeyer

 *grimm26 wrote:*   

> remove or comment  
> 
> ```
> config_wlan0=( "dhcp" ) 
> ```
> ...

 

Well, yes, I am changing that line to config_wlan0=( "192.168.1.102 broadcast 192.168.1.255 netmask 255.255.255.0" ) ....

----------

## eyoung100

```
config_wlan0=( "192.168.1.102 broadcast 192.168.1.255 netmask 255.255.255.0" )
```

per the Gentoo Handbook - 8. Configuring your System has broadcast shorthanded as brd.

See also:

Gentoo Linux Documentation - Wireless Networking

Code Listing 9: override network settings per ESSID

 *Gentoo Linux Documentation -- Wireless Networking wrote:*   

> 
> 
> ```
> 
> config_ESSID1=( "192.168.0.3/24 brd 192.168.0.255" )
> ...

 

I think that the above is missing from your /etc/conf.d/net file.

----------

## strathmeyer

 *eyoung100 wrote:*   

> 
> 
> ```
> config_wlan0=( "192.168.1.102 broadcast 192.168.1.255 netmask 255.255.255.0" )
> ```
> ...

 

Amazingly, this seems to have been the problem. I'm pretty sure I saw broadcast written out in some example. This is even more embarrassing because explicitly providing those parameters is unnecessary in this case.

Once I changed this I could connect to my router even when I left the router's DHCP server on, which is what I expected should've been happening.

I understand the functionality of the further code you provided but it isn't what I need. Thanks for the help.

----------

## eyoung100

Congratz

----------

