I have a Raspberry Pi being used as a media server kind of system in my home. I have 2 internet connections, Router-1 is right next to Pi along with my PC and both are connected to Router-1 via it's ethernet ports.

Router-2 is in other room but has much better wifi coverage in rest of the house compared to Router-1.

On Pi, I'm running Transmission and miniDLNA.

My requirements are:

1) Pi should be accessible to all devices connected to wifi of Router-2.

2) The torrents and other downloads on Pi should use Router-2 wifi.

3) Pi should be accessible via SSH, NOmachine etc on my PC which doesn't have wifi.

For this, I've tried various combinations without any luck. Pi always connects to Router-1's wifi by default and I have to change it manually to Router-2 everytime. After I added Priority in wpasupplicant.conf file, Pi is connecting to Router-2 first, but the files on it (incuding minidlna) are not accessible to other devices connected to Router-2 wifi.

What changes do I need to make ?

Following is interfaces.conf file.

# interfaces(5) file used by ifup(8) and ifdown(8)

# Please note that this file is written to be used with dhcpcd
# For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf'

# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback
iface eth0 inet dhcp

iface eth0 inet static

allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface Router-2 inet static

#auto wlan0
#iface wlan0 inet static
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

#allow-hotplug wlan1
#iface wlan1 inet manual
 #wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
  • Your settings do not make sense; See How do I set up networking/WiFi/Static IP . This question is not specific to the Pi, it is about how to configure your routers, and you have provided insufficient information for anyone to answer.
    – Milliways
    Mar 5 '17 at 21:39

1) First since the release of Jessie, many tutorials or past posts of changing the /etc/network/interfaces became obsoleted. It was common in previous OS release to make changes directly to the /etc/network/interfaces for network configuration. When using Jessie, it will be necessary to make changes through /etc/dhcpcd.conf.

2) As mentioned by @Millways, your configuration doesn't make sense. If your netmask is, then both of your routers are actually on the same network instead of what you said on two different networks. Therefore you should check both of your router configurations and provide more information so that others can help you.

3) Since we don't have sufficient information on how your two networks are configured. But in general, if you have two sub networks (e.g. and with an assumption of netmask of, in order for each network to be able to communicate with the other, you need to setup a static route at router A with settings like route add gw (as per your example), and another static route at router B as route add gw These can be done at routers. On the raspberry pi, you will need to setup your wlan0 ssid credentials to connect to router B. Hope this give you a general direction to work it out.

  • I've been experimenting with different configurations.So the interfaces file looks weird. Both modem/wifi-routers are meant to be on the same network with different IPs I don't exactly care if two different devices on two networks of these routers can communicate with each otther. I just want that the Pi be accessible from any device connected with wifi of any router.
    – jjamwal
    Mar 10 '17 at 12:25
  • Are the two routers actually connected to each other? If so, this can be made to work. If not, devices connected to one will not be able to connect to devices on the other. If an Ethernet cable between them is not possible, look into PowerLine adapters or something similar. If you split the internal network into 2 separate IP subnets, you could create a VPN tunnel between routers over the Internet, although that would be a bit silly.
    – bobstro
    Sep 23 '17 at 3:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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