# [solved] IPv4 for Wifi Interface

## embeddedmz

Hello,

Gentoo noob here, I'm using wpa_supplicant, and I don't know why DHCP daemon doesn't assign an IPv4 address to the Wifi interface (unlike the Ethernet one). Thus, I don't have access to internet. 

```
wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet6 fe80::52b7:c3ff:fe55:7251  prefixlen 64  scopeid 0x20<link>

        ether 50:b7:c3:55:72:51  txqueuelen 1000  (Ethernet)

        RX packets 3313  bytes 1472126 (1.4 MiB)

        RX errors 0  dropped 22  overruns 0  frame 0

        TX packets 18  bytes 1924 (1.8 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

On my other laptop, running Ubuntu, everything is fine (no internet box problem) :

```
wlp8s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.46  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::5d6e:a7eb:ef1e:f49c  prefixlen 64  scopeid 0x20<link>

        ether 30:10:b3:9d:b4:05  txqueuelen 1000  (Ethernet)

        RX packets 41330  bytes 33105158 (33.1 MB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 28854  bytes 5525325 (5.5 MB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

How to tell DHCP or WPA_SUPPLICANT to give an IPv4 to the wireless interface ?

Thanks.

[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]Last edited by embeddedmz on Sun Jan 05, 2020 6:47 pm; edited 1 time in total

----------

## pjp

Have you gone through this?

https://wiki.gentoo.org/wiki/Wpa_supplicant

----------

## embeddedmz

Yes, I followed especially "Setup the network manager". I used "wpa_gui" to configure the connection to my internet box. In the GUI, I can also see that I'm connected but there is no IPv4 address.

```

#cat /etc/conf.d/net

modules_wlp1s0="wpa_supplicant"

config_wlp1s0="dhcp"

config_enp2s0="dhcp"
```

```
# cat /etc/wpa_supplicant/wpa_supplicant.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

update_config=1

network={

   ssid="SFR_6CC0"

   psk="MY_PSK#########"

   proto=RSN

   key_mgmt=WPA-PSK

   pairwise=CCMP

   auth_alg=OPEN

}
```

[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]

----------

## NeddySeagoon

embeddedmz,

Please put your dmesg output onto a pastebin.

With no networking, you will need to save it to USB then post from elsewhere.

Or save it to your gentoo, then boot with something that allows networking to work.

While you are posting things 

```
lspci -k
```

and 

```
lsusb
```

will be useful, as well as your kernel .config file.

----------

## embeddedmz

I still have an ethernet connection  :Wink: 

dmesg : https://pastebin.com/YWSbfFet

.config : https://pastebin.com/7fHrRnUP (/usr/src/linux/.config - I checked that the files under /boot have been updated)

```
$ lspci -k

00:00.0 Host bridge: Intel Corporation 2nd Generation Core Processor Family DRAM Controller (rev 09)

   Subsystem: Samsung Electronics Co Ltd NP300E5C series laptop

00:02.0 VGA compatible controller: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller (rev 09)

   Subsystem: Samsung Electronics Co Ltd 2nd Generation Core Processor Family Integrated Graphics Controller

   Kernel driver in use: i915

00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04)

   Subsystem: Samsung Electronics Co Ltd NP300E5C series laptop

00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04)

   Subsystem: Samsung Electronics Co Ltd NP300E5C series laptop

   Kernel driver in use: ehci-pci

00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04)

   Subsystem: Samsung Electronics Co Ltd NP300E5C series laptop

   Kernel driver in use: snd_hda_intel

00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4)

   Kernel driver in use: pcieport

00:1c.3 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 4 (rev c4)

   Kernel driver in use: pcieport

00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04)

   Subsystem: Samsung Electronics Co Ltd NP300E5C series laptop

   Kernel driver in use: ehci-pci

00:1f.0 ISA bridge: Intel Corporation HM70 Express Chipset LPC Controller (rev 04)

   Subsystem: Samsung Electronics Co Ltd HM70 Express Chipset LPC Controller

00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)

   Subsystem: Samsung Electronics Co Ltd NP300E5C series laptop

   Kernel driver in use: ahci

00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04)

   Subsystem: Samsung Electronics Co Ltd NP300E5C series laptop

   Kernel driver in use: i801_smbus

01:00.0 Network controller: Qualcomm Atheros AR9485 Wireless Network Adapter (rev 01)

   Subsystem: Samsung Electronics Co Ltd AR9485 Wireless Network Adapter

   Kernel driver in use: ath9k

02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 06)

   Subsystem: Samsung Electronics Co Ltd RTL8168 on a NP300E5C series laptop

   Kernel driver in use: r8169

```

```
$ lsusb

Bus 002 Device 003: ID 0cf3:3004 Qualcomm Atheros Communications AR3012 Bluetooth 4.0

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 001 Device 003: ID 0ac8:c349 Z-Star Microelectronics Corp. 

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
```

----------

## NeddySeagoon

embeddedmz,

Your wired ethernet card would like to do a firmware update.

```
[   22.103313] r8169 0000:02:00.0: Direct firmware load for rtl_nic/rtl8168e-3.fw failed with error -2

[   22.103325] r8169 0000:02:00.0 enp2s0: unable to load firmware patch rtl_nic/rtl8168e-3.fw (-2)

[   22.103594] RTL8211E Gigabit Ethernet r8169-200:00: attached PHY driver [RTL8211E Gigabit Ethernet] 
```

and the hard bit of Wifi works

```
[   22.386713] wlp1s0: authenticate with 60:35:c0:21:6c:c6

[   22.407229] wlp1s0: send auth to 60:35:c0:21:6c:c6 (try 1/3)

[   22.409241] wlp1s0: authenticated

[   22.410014] wlp1s0: associate with 60:35:c0:21:6c:c6 (try 1/3)

[   22.413929] wlp1s0: RX AssocResp from 60:35:c0:21:6c:c6 (capab=0x1411 status=0 aid=3)

[   22.414140] wlp1s0: associated
```

How did you start wlp1s0?

It probably does not have an IP address because it was never asked to get one.

As a test stop your wired ethernet.

Then 

```
dhcpcd wlp1s0
```

If you have both interfaces in the same subnet at the same time only one will ever be used and the network may not work at all.

----------

## embeddedmz

 *NeddySeagoon wrote:*   

> How did you start wlp1s0?

 

I think it's wpa_supplicant who handles that (/etc/init.d/wpa_supplicant)

 *NeddySeagoon wrote:*   

> As a test stop your wired ethernet.
> 
> Then
> 
> Code:
> ...

 

It works now !

By doing so, it also enabled the wired connection (enp2s0). Is that normal ?

Yesterday, I tried calling dhcpcd on the wireless interface but without stopping the wired one and it blocked indefinitely.

So, how can I fix this mess at boot time : I have two scripts net.enp2s0 (symbolic link to net.lo) and wpa_supplicant.

Otherwise, recently I added ifplugd_enp2s0="..." to /etc/conf.d/net, to automatically enable wired interface when plugging the Ethernet cable.

```
$ ifconfig -a

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.40  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::3546:6f1:7924:1cb5  prefixlen 64  scopeid 0x20<link>

        ether 50:b7:c3:72:21:1e  txqueuelen 1000  (Ethernet)

        RX packets 1279  bytes 115604 (112.8 KiB)

        RX errors 0  dropped 6  overruns 0  frame 0

        TX packets 783  bytes 110363 (107.7 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Boucle locale)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

sit0: flags=128<NOARP>  mtu 1480

        sit  txqueuelen 1000  (IPv6-dans-IPv4)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp1s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.1.70  netmask 255.255.255.0  broadcast 192.168.1.255

        inet6 fe80::52b7:c3ff:fe55:7251  prefixlen 64  scopeid 0x20<link>

        ether 50:b7:c3:55:72:51  txqueuelen 1000  (Ethernet)

        RX packets 1095  bytes 442448 (432.0 KiB)

        RX errors 0  dropped 6  overruns 0  frame 0

        TX packets 30  bytes 3643 (3.5 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

 *NeddySeagoon wrote:*   

> If you have both interfaces in the same subnet at the same time only one will ever be used and the network may not work at all.

 

I didn't understand, in the above ifconfig's output, both interfaces do belong to the same subnet (192.168.1.0) - even in my ubuntu laptop, I have the same thing.

 *NeddySeagoon wrote:*   

> Your wired ethernet card would like to do a firmware update.

 

What shall I do ?

and what about the interface sit0 ? why does it exist ?

[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]

----------

## NeddySeagoon

embeddedmz,

wpa_supplicant only takes care of the association ash authentication.

After that, the wired interface tools take over.  

Your /etc/conf.d/net script needs something like the wikishows.

My statement about two interfaces in the same subnet being a source of problems is an over simplification.

If they both have different route metrics, the interface with the lowest metric is used.

The metrics aro shown in the output of route. I only have one interface.

```
$ route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         router          0.0.0.0         UG    2      0        0 eth0

loopback        0.0.0.0         255.0.0.0       U     0      0        0 lo

loopback        localhost       255.0.0.0       UG    0      0        0 lo

192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0
```

----------

## embeddedmz

Thank you NeddySeagoon, I fixed my problem by removing : /etc/init.d/net.enp2s0. That will let wpa_supplicant configure also the wired interface.

and thanks for the informations related to routing !

----------

