jjamwal
Posts: 3
Joined: Thu Dec 24, 2015 12:58 pm
Location: India
Contact: Website

Connecting Pi to 2 different modems and accessing it

Fri Mar 10, 2017 1:03 pm

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

Router-2 192.168.1.100 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.

Code: Select all

# 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
     address 192.168.1.21
     network 192.168.1.0
     netmask 255.255.255.0
     broadcast 192.168.1.255
     gateway 192.168.1.1



allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface Router-2 inet static
address 192.168.1.20
gateway 192.168.1.100
netmask 255.255.255.0


#auto wlan0
#iface wlan0 inet static
#address 192.168.1.22
#netmask 255.255.255.0
#gateway 192.168.1.100
#wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf



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

Output of route:

Code: Select all

route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         192.168.1.1     0.0.0.0         UG    202    0        0 eth0
default         192.168.1.1     0.0.0.0         UG    303    0        0 wlan0
192.168.1.0     *               255.255.255.0   U     202    0        0 eth0
192.168.1.0     *               255.255.255.0   U     303    0        0 wlan0

Return to “Networking and servers”