Chuck
Posts: 6
Joined: Sun Jul 07, 2013 11:10 am

Two interfaces {eth0,wifi} with fixed IP not working

Mon Jul 27, 2015 7:40 pm

Hi all,

I have a bit odd issue with my Raspberry Pi 2. It has two network interfaces - eth0 and a wifi dongle. Now, I would like give both static IPs - which is not working, but every time I bring wlan0 up, networkign effectively freezes and recovers when disconnecting the wifi dongle.

The kernel is updated to the most recent kernel

Code: Select all

[Linux rasppi2 4.0.9-v7+ #807 SMP PREEMPT Fri Jul 24 15:21:02 BST 2015 armv7l GNU/Linux
for which I have build the drivers for the Wifi dongle's rtl8812au chipset. After building and loading the driver the first time, I was actually successful to connect to my network over ethernet with fixed IP as well as via wifi with DHCP providing an IP.

Thus, I fixed the IP for the wlan0 interface as I had fixed it for eth0. That resulted in all my trouble and I had not been abled to get both interfaces to run in parallel. When I bring up wlan0, networking freezes over both interfaces. Sometimes I see on my DHCP server a IP assigned over the wifi to my RP2 with the fixed IPs connected on the ethernet MAC - while I have for all interfaces DHCP disabled?? Anyway, networking is failing in general and I don't manage to get a TCP package in our out. The situation improves immediately when disconnecting the dongle.

Thus, my first step was to disable to bring wlan0 automatically up when booting or attaching the dongle and use only if{up,down}...
Then I tried to move the wifi credentials from wpa_supplicant into /etc/network/interfaces and reduce one dependency -- working in some way, since the dongle checked in successfully into my wifi, thus the basic network layer has always been available ~~> iwconfig was happy.

My networking configuration looks currently like

> /etc/network/interfaces

Code: Select all

auto lo
iface lo inet loopback

#allow-hotplug wlan0
#iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.3.30
gateway 192.168.3.1
network 192.168.3.0
netmask 255.255.255.0
broadcast 192.168.3.255

#auto wlan0
iface wlan0 inet static
address 192.168.3.31
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
# wpa-ssid "MYWIFI"
# # wpa_passphrase MyWifi MyWifiKey
# # wpa-psk MyWifiPSK
# wpa-psk "MyWifiKey"
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
Following, I switched back to wpa_supplicant and tried to fix by extending its config.
For wpa_supplicant, I played with quite some parameters starting from a plain vanilla config with just the ssid and key set.
I assumed that setting 'id_str' to an interface's name would 'bind' this wifi to this interface and be picked up, when bringing this interface up - apparently without success for me :(

with my current wpa_supplicant looking like

> /etc/wpa_supplicant/wpa_supplicant.conf

Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="MyWifi"
    psk="MyWifiKey"
    #psk=MyWifiPSK
    key_mgmt=WPA-PSK
    pairwise=CCMP
    group=TKIP CCMP
    scan_ssid=1
    proto=RSN
    auth_alg=OPEN
    id_str="wlan0"
}
Interestingly with id_str set, the interface showing up in ifconfig is marked as ethernet and thus the IP seems to be bound to eth0 as well, but networking clashing.

One idea would be, that I have to set some dedicated route or prioritise one interface over the other, i.e., prefer eth0 for all traffic when available and fall back to wlan0 else?? But why did I had no problem with wlan0 getting a DHCP IP?

It is quite opaque to me... :?
Maybe somebody has an idea what is broken here?

Cheers and thanks for any ideas,
Thomas

User avatar
DougieLawson
Posts: 39204
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Two interfaces {eth0,wifi} with fixed IP not working

Tue Jul 28, 2015 8:54 am

sudo apt-get purge ifplugd

That useless piece of rubbish will deactivate your WiFi when your eth0 interface comes active, so remove it.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Chuck
Posts: 6
Joined: Sun Jul 07, 2013 11:10 am

Re: Two interfaces {eth0,wifi} with fixed IP not working

Tue Jul 28, 2015 6:01 pm

DougieLawson wrote:sudo apt-get purge ifplugd
@DougieLawson

You are my hero! Without ifplugd everything works flawlessly and both interfaces coesxists beatifully!
Why would someone wants to have such a 'service' as default?! I was starting to questioning my sanity...

Cheers and many thanks,
Thomas

User avatar
DougieLawson
Posts: 39204
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Two interfaces {eth0,wifi} with fixed IP not working

Wed Jul 29, 2015 11:42 am

Chuck wrote: Why would someone wants to have such a 'service' as default?! I was starting to questioning my sanity...
It's a "Because Windows works that way.™" thing. It's probably an ideal option for the new users who have never used Linux before getting their shiny new RPi.
Note: Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

Criticising any questions is banned on this forum.

Any DMs sent on Twitter will be answered next month.
All non-medical doctors are on my foes list.

Return to “Advanced users”