1

I am setting up a web server on my raspberry pi. I want to connect it to my router via ethernet (static ip) but if the ethernet is disconnected I want it to automatically start using the wifi (static ip).

The eth0 static ip definition works but my wifi static ip definition does not. My router ends of confused with the wifi ip and either doesn't give an ip address at all or uses dhcp.

I have researched the /etc/network/interfaces but I haven't found a thorough tutorial and I'm left with other specific questions in addition to my main objective.

Here is my current /etc/network/interfaces file.

source-directory /etc/network/interfaces.d

iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.1.66
        netmask 255.255.255.0
        network 192.168.1.64
        broadcast 192.168.1.253
        gateway 192.168.1.254

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

iface home inet static
        address 192.168.1.68
        netmask 255.255.255.0
        network 192.168.1.64
        broadcast 192.168.1.253
        gateway 192.168.1.254

iface default inet dhcp

Here is my /etc/wpa_supplicant/wpa_supplicant.conf

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

network={
        ssid="r0uter"
        psk="Xxxxxxxx"
        key_mgmt=WPA-PSK
        id_str="home"
}

Router status of server's wlan0 and eth0

Router status and details of wlan0

**Why is my router using DHCP on my server's wlan0 instead of using my static ip definition?

What is the purpose of iface lo inet loopback? And what would happen if I left it out?

What is the purpose of auto eth0 or auto lo or auto wlan0?

What is the purpose of allow-hotplug wlan0 and what would happen if I left it out?**

Thanks for any help.

deanresin
  • 432
  • 1
  • 5
  • 22
  • 1
    For this scenario I'd suggest using bonding. Some time ago I wrote an answer for this (http://unix.stackexchange.com/questions/125114/using-wifi-port-as-redundant-link/125191#125191). – Andreas Wiese May 09 '16 at 21:28
  • 1
    @AndreasWiese is correct, bonding is probably the right way to go on this. However, for a more RasPi centric answer, I suggest installing ifenslave and taking a look at it's man page and examples. – OldTimer May 11 '16 at 00:40

0 Answers0