ccy
Posts: 21
Joined: Mon Sep 23, 2013 7:27 am

eth0 can't get IP address if both wlan0 and eth0 plugged in

Tue Apr 07, 2015 8:50 am

I am using latest archlinuxarm on Raspberry Pi 2. Both my eth0 and wlan0 device works with DHCP if I plug the cable and usb dongle separately.

When both devices are plugged in, only wlan0 device can obtain IP address and eth0 device doesn't obtain any IP address. I have to execute

Code: Select all

dhcpcd eth0
explicitly to obtain IP address for eth0.

The wlan0 device is configure using systemd and wpa_supplicant:

Create a systemd unit, e.g /etc/systemd/system/network-wireless@.service:

Code: Select all

cat /etc/systemd/system/network-wireless@.service

[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes

ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant/wpa_supplicant.conf
ExecStart=/usr/bin/dhcpcd %i

ExecStop=/usr/bin/ip link set dev %i down

[Install]
WantedBy=multi-user.target
Can I make both device's up and running for my Pi 2?

sdjf
Posts: 1395
Joined: Fri Mar 16, 2012 5:20 am
Location: California
Contact: Website

Re: eth0 can't get IP address if both wlan0 and eth0 plugged

Thu Apr 09, 2015 4:24 pm

Since no one else has answered you, although this is not my setup, may I suggest you consider having either a cron job or a script that runs automatically a few minutes after each boot/reboot, and runs your dhcpcd command? There may be a way to get the systemd service file to wait until after the other service is up and actually do that, but if you cannot figure that out, this may be another way to go.

You could have a script that tested whether both networks were up and running and, if they were not, it would start the missing service. I do something similar to this on my pi, with a script that makes sure that both my usb0 and eth0 are active, so I don't have to restart them if they drop out.
FORUM TIP: To view someone's posting history, sign in, click on their user name, then on "Search User's Posts." || Running ArchLinuxArm on Model 2B and 512MB Model B

ccy
Posts: 21
Joined: Mon Sep 23, 2013 7:27 am

Re: eth0 can't get IP address if both wlan0 and eth0 plugged

Fri Apr 10, 2015 2:41 am

Your suggestion shall works but there should have more elegant ways to make both devices up at boot time. I think we need more time to research the issue.
sdjf wrote:Since no one else has answered you, although this is not my setup, may I suggest you consider having either a cron job or a script that runs automatically a few minutes after each boot/reboot, and runs your dhcpcd command? There may be a way to get the systemd service file to wait until after the other service is up and actually do that, but if you cannot figure that out, this may be another way to go.

You could have a script that tested whether both networks were up and running and, if they were not, it would start the missing service. I do something similar to this on my pi, with a script that makes sure that both my usb0 and eth0 are active, so I don't have to restart them if they drop out.

carloxic
Posts: 6
Joined: Mon Apr 07, 2014 3:18 pm

Re: eth0 can't get IP address if both wlan0 and eth0 plugged

Mon Apr 27, 2015 6:18 pm

I have what you are asking for. On my system it works just like that out-of-the-box. I checked retropie and raspbmc (both are raspbian based).

All you need to do is configure your http://manpages.ubuntu.com/manpages/tru ... ces.5.html
Pay special attention to the manpage where it says *auto*, this will help you.

Return to “Arch”