# wpa_supplicant and dhclient (dhcpd)

## elmar283

I'm trying to make chclient work with wpa_supplicant. 

I'm maneging to make wpa_supplicant connect to my wi-fi using the wpa protocol. After connection I don't have an ip-addres. To get one I'll have to run 

```
dhclient eth1
```

.

How can I make net.eth1 do this automaticly. modules_eth1="wpa_supplicant dhclient" doesn't work. 

Here are my config files:

```

elmarotter@masterserver ~ $ cat /etc/conf.d/net

# This blank configuration will automatically use DHCP for any net.*

# scripts in /etc/init.d.  To create a more complete configuration,

# please review /usr/share/doc/openrc/net.example and save your configuration

# in /etc/conf.d/net (this file :]!).

dns_domain_lo="eotter1979.xs4all.nl"

config_eth0="192.168.0.1 netmask 255.255.255.0 brd 192.168.0.255"

#routes_eth0="default via 192.168.0.1"

dns_servers_eth0="192.168.0.1"

associate_timeout_eth0=60

#gateways_eth1="192.168.178.1"

iwconfig_eth1="mode managed"

modules_eth1="wpa_supplicant dhclient"

wpa_supplicant_eth1="-Dwext -c /etc/wpa_supplicant/wpa_supplicant.conf"

wpa_timeout_eth1=60

associate_timeout_eht1=60

dhcp_Earth="release nodns"

#modules_Earth="dhclient"

#config_Earth="192.168.178.28 netmask 255.255.255.0 brd 192.168.178.255"

#dns_servers_eth1="192.168.0.1"

#routes_eth1="default via 192.168.178.1"

#config_Earth="dhcp"

#fallback_Earth="dhcp"

##fallback_Earth="192.168.178.28/24"

#fallback_route_Earth="default via 192.168.178.1"

#dns_servers_Earth="192.168.0.1"

#dns_domain_Earth="eotter1979.xs4all.nl"

#dns_search_domains_Earth="eotter1979.xs4all.nl"

elmarotter@masterserver ~ $ 

```

```

elmarotter@masterserver ~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 

Wachtwoord: 

# The below line not be changed otherwise we refuse to work

update_config=1

ctrl_interface_group=0

ctrl_interface=/var/run/wpa_supplicant

eapol_version=1

ap_scan=1

country=nl_NL

network={

  ssid="Earth"

  proto=WPA

  key_mgmt=WPA-PSK

  pairwise=CCMP TKIP

#  group=CCMP TKIP

  group=CCMP TKIP WEP104 WEP40

  psk="xxxxxxxxxxxxxxxxx"

  priority=5

} 

#network={

#  ssid="Sweex_LW310V2"

#  key_mgmt=NONE

#  priority=NONE

#}

elmarotter@masterserver ~ $ 

```

```
elmarotter@masterserver ~ $ cat /etc/dhcp/dhclient.conf 

#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;

#send dhcp-lease-time 3600;

#supersede domain-search "fugue.com", "home.vix.com";

#prepend domain-name-servers 192.168.0.1;

#request subnet-mask, broadcast-address, time-offset, routers,

#   domain-name, domain-name-servers, host-name;

#require subnet-mask, domain-name-servers;

timeout 60;

retry 60;

reboot 10;

select-timeout 5;

initial-interval 2;

#media "-link0 -link1 -link2", "link0 link1";

#reject 192.33.137.209;

#alias {

#   interface "eth1";

#   fixed-address 192.168.178.28;

#   option subnet-mask 255.255.255.0;

#}

lease {

   interface "eth1";

   fixed-address 192.168.178.28;

   option subnet-mask 255.255.255.0;

   option routers 192.168.178.1;

   option domain-name-servers 192.168.0.1;

}

#lease {

#  interface "ep0";

#  fixed-address 192.33.137.200;

#  medium "link0 link1";

#  option subnet-mask 255.255.255.0;

#  option broadcast-address 192.33.137.255;

#  option routers 192.33.137.250;

#  option domain-name-servers 127.0.0.1;

#  renew 2 2000/1/12 00:00:01;

#  rebind 2 2000/1/12 00:00:01;

#  expire 2 2000/1/12 00:00:01;

#}

elmarotter@masterserver ~ $ 

```

Snapshot of /var/log/messages after /etc/initi.d/net.eth1 restart

```

Sep 30 17:35:22 masterserver avahi-daemon[2702]: Withdrawing address record for 192.168.178.28 on eth1.

Sep 30 17:35:22 masterserver avahi-daemon[2702]: Leaving mDNS multicast group on interface eth1.IPv4 with address 192.168.178.28.

Sep 30 17:35:22 masterserver avahi-daemon[2702]: Interface eth1.IPv4 no longer relevant for mDNS.

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:22 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:23 masterserver /etc/init.d/net.eth1[30599]: WARNING: net.eth1 has started, but is inactive

Sep 30 17:35:56 masterserver sudo: elmarotter : TTY=pts/2 ; PWD=/home/elmarotter ; USER=root ; COMMAND=/etc/init.d/net.eth1 stop

Sep 30 17:35:56 masterserver sudo: pam_unix(sudo:session): session opened for user root by elmarotter(uid=1000)

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:35:56 masterserver dhclient: receive_packet failed on eth1: Network is down

Sep 30 17:36:01 masterserver cron[31175]: (amavis) CMD (find /var/amavis/.maildir/Bayes/.redeliver/cur/ -type f -name "[0-9]*" -exec cp {} /var/amavis/.maildir/Bayes/.ham/cur/ \; && find /var/amavis/.maildir/Bayes/.redeliver/cur/ -type f -name "[0-9]*" -exec /usr/local/bin/redeliver.pl {} \;)

Sep 30 17:36:08 masterserver sudo: elmarotter : TTY=pts/2 ; PWD=/home/elmarotter ; USER=root ; COMMAND=/etc/init.d/net.eth1 start

Sep 30 17:36:08 masterserver sudo: pam_unix(sudo:session): session opened for user root by elmarotter(uid=1000)

Sep 30 17:36:08 masterserver /etc/init.d/net.eth1[31195]: WARNING: net.eth1 has started, but is inactieve

```

And after dhclient eth1:

```

Sep 30 17:37:47 masterserver dhclient: DHCPREQUEST on eth1 to 255.255.255.255 port 67

Sep 30 17:37:47 masterserver dhclient: DHCPACK from 192.168.178.1

Sep 30 17:37:47 masterserver avahi-daemon[2702]: Joining mDNS multicast group on interface eth1.IPv4 with address 192.168.178.28.

Sep 30 17:37:47 masterserver avahi-daemon[2702]: New relevant interface eth1.IPv4 for mDNS.

Sep 30 17:37:47 masterserver avahi-daemon[2702]: Registering new address record for 192.168.178.28 on eth1.IPv4.

Sep 30 17:37:47 masterserver dhclient: bound to 192.168.178.28 -- renewal in 418535 seconds.
```

----------

## elmar283

I have just put dhclient $1 at the bottom of "/etc/wpa_supplicant/wpa_cli.sh". It does do the trick alhow I can harldy expect that this is the right way to fix my problem. So still I would like to here what the right way is.

----------

