Setting up WiFi and Ethernet Simultaneously on RPI/Raspberrypi

Look at the wpa_supplicant.conf file:

pi@raspberrypi ~ $ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf 
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="****"
    scan_ssid=1
    proto=RSN
    key_mgmt=WPA-PSK
    pairwise=CCMP TKIP
    group=CCMP TKIP
    psk="****"
    id_str="home"
    priority=5
}

Next my new update interfaces file

pi@raspberrypi ~ $ sudo cat /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
address 192.168.0.157
netmask 255.255.255.0
broadcast 192.168.0.255
gateway 192.168.0.1

iface default inet dhcp

And now comes the tricky part, you have to disable the hotplugging of the eth0 device (else it will disable your wlan0). You do this by edting the following file:

pi@raspberrypi ~ $ sudo cat /etc/default/ifplugd 
INTERFACES="eth0"
HOTPLUG_INTERFACES="eth0"
ARGS="-q -f -u0 -d10 -w -I"
SUSPEND_ACTION="stop"

I also have the following in my startup script, this will make sure my wifi does get started up (sometimes for no reason at all it would not start). You also have to kill the ifplugd daemon on the eth0 device:

pi@raspberrypi ~ $ sudo cat /etc/rc.local
#!/bin/sh -e

# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
  printf "My IP address is %s\n" "$_IP"
fi

# Disable the ifplugd eth0
sudo ifplugd eth0 --kill
sudo ifup wlan0

exit 0

if you’re getting ip from DHCP and dont want/cant ssh into the RPI you can use nmap from your host and scan the machine with OSdetect & fingerprint. like this

$nmap -sV -O -v 129.128.X.XX

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

DONE.

THANKS TO ( https://raspberrypi.stackexchange.com/questions/8851/setting-up-wifi-and-ethernet/24685#24685 )

One thought on “Setting up WiFi and Ethernet Simultaneously on RPI/Raspberrypi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s