0

I'm trying to achieve the following with my RPi3:

  • Static eth0 IP. This connects to my car's infotainment system.
  • DHCP wlan0 IP. This is for the RPi3 to connect to my home Wifi while the car is in the garage
  • Both eth0 and wlan0 must be up at the same time
  • I have no need to route traffic from the car's infotainment system through the RPi to Wifi or vice-versa (actually I want to prevent this)

My current situation is, with the /etc/network/interfaces file below, the wlan0 is working fine, but eth0 has no IP address and is unusable.
When I add "inet" to the iface eth0 configuration line, eth0 gets the static IP address, but wlan0 ceases to work. The wlan0 IP assigned to RPi by Wifi equipment is 192.168.1.20; netmask is 255.255.255.0.

auto lo
iface lo inet loopback

auto eth0
iface eth0 static
address 192.168.42.1
netmask 255.255.255.0
# Car's infotainment IP 192.168.42.3

allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
1

2 Answers 2

1

What you have has a number of errors, and would not have worked.

Indeed the proper configuration would NOT have enabled both interfaces simultaneously. dhcpcd will configure both (if correctly setup).

See How do I set up networking/WiFi/Static IP

1

What worked for me (can communicate with Pi from eth side and wlan side):

/etc/network/interfaces

auto wlan0
auto lo
iface lo inet loopback

allow-hotplug eth0
inet eth0 inet manual

allow-hotplug wlan0
iface wlan0 inet manual

/etc/wpa_supplicant/wpa_supplicant.conf:

network={
ssid="MYSSID"
key_mgmt=WPA-PSK
proto=RSN
psk="MYPSK"
}

/etc/dhcpcd.conf (using 192.168.42.2 as Pi IP and 192.168.42.1 as Car IP)

interface eth0
static ip_address=192.168.42.2/24
static routers=192.168.42.1
static domain_name_servers=192.168.42.1 8.8.8.8

interface wlan0
static ip_address=undefined/24
static routers=undefined
static domain_name_servers=undefined 8.8.8.8

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.