# Wireless fails to "up" IPv4 automatically, [solved]

## Terlisimo

Using wpa-supplicant.

I have net.eth0 and net.wlan0 set up to start up automatically by default.

If I run /etc/init.d/net.wlan0 restart manually as root, everything works fine.

However, *every* time the system boots up, connects to my AP, it self-assigns IPv6 address but it doesn't acquire an IPv4 address. Manually restarting net.wlan0 after that fixes the problem. 

First I thought it was a dhcp issue so I entered a static IPv4 address... with exactly same result (I get v6, no v4).

Then I disabled IPv6 on all interfaces through sysctl.conf; didn't do anything except then wlan0 didn't get any addresses at all.

So I made /etc/local.d/wireless-repair.start with "sleep 10; /etc/init.d/net.wlan0 restart" in it... and still no IPv4 address. So I put another sleep and another restart in it... and STILL same result. Script was definitely executed, I could see output in console from restarting net.wlan0. It restarted wpa-supplicant, it connected and authenticated with an AP but got no IPv4 addr.

The thing that finally worked for me was this:

/etc/local.d/restart_wireless.start:

```
#!/bin/bash

/etc/local.d/restart_wireless_helper &
```

/etc/local.d/restart_wireless_helper:

```
#!/bin/bash

sleep 5

/etc/init.d/net.wlan0 restart
```

So... for some reason, my system simply refuses to bring up IPv4 on wlan0 if it's part of the init process... only scheduling restart as a background process worked. Weird.

So, it's fixed for now but it's quite an ugly hack.

I saw similar issues with WPA on this forum, hopefully this can provide clues whether this is a bug or a configuration issue.

If anyone wants to see my config files, logs, package versions or anything, just ask which ones you want.Last edited by Terlisimo on Mon Jan 14, 2013 12:07 am; edited 1 time in total

----------

## CrankyPenguin

You might look into DHCLIENT.  I know that a number of people, myself included, have found that newer versions of dhcpcd are IPv6 specific.  Current versions of DHCLIENT seem to do better with IPv4.

----------

## Terlisimo

Figured out the cause... my bad  :Smile: 

I used a script in /etc/local.d/ to remount /tmp as zRam, that's when things went bad.

/etc/local.d scripts started after net.wlan0... and net.wlan0 puts a file in /tmp for internal purposes. After remounting that file was lost... 

Solution was to load zRam module and remount /tmp as soon as possible in the boot process, before demons start putting their things in it (wpa-supplicant was the only one for me).

----------

