PC connected to two networks

Jun 20, 2018
1
0
10
I have two networks:
Network1 on a Speedtouch something modem, gateway 192.168.1.1, used for the internet connection. It has an unmanaged switch connected to it.
Network2 on a TP-Link routher, gateway 192.168.0.1, used for a raspberry pi and various wireless arduino automations. It also has an unmanaged switch connected to it.
There is a cable connecting the 2 switches.
PC running Win7 is connected via cable to the first switch and has default gateway 192.168.1.1.
Raspberry Pi is connected to Network2 via wifi and its assigned ip is 192.168.0.160

I need to access the raspberry pi in the browser from the pc.

I tried changing the gateway on the pc to 192.168.0.1 and manually assign an ip to it from TP-Link using its mac address. Didn't work.

So, how do i accomplish this?



 
You are going to get very messy situation connecting the 2 switches together. You have in effect put both network in the physical network and are likely running 2 dhcp servers.

Your main problem is you do not have a actual router to solve this. That is the main purpose of a router to allow communication between multiple ip networks.

Your best option is to change all the ip addresses to the same subnet so it just works using the equipment you have. Your devices are not really being protected it is just that they do not know about each other but thing like broadcasts ...and dhcp uses broadcast... are intermixed.

A very non standard solution which I highly recommend you do not do is to assign a secondary IP address to your nic in the other subnet. This ability was really put in to allow migration from one subnet to another it is not really suppose to be used as a intentional network design.
 
There may be another way to keep the two networks separate but allow the PC to connect to the Raspberry Pi. I assume you're trying to keep devices in Network2 from getting access outside Network2 (and the Internet)?

Assign the Raspberry Pi a static IP address on Network2's LAN. Plug the WAN port on the Router2 (router for Network2) into a LAN port on the router for Network1. Assign Router2's WAN port a static IP address on Network1's LAN.

Depending on what network options your router gives you, you may be able to modify the routing table to delete the wildcard IP addresses being redirected to the WAN. Only the 192.168.1.x subnet should be routed through the WAN. This will basically configure the router so traffic to 192.168.0.x IP addresses are sent to its LAN. Traffic to 192.168.1.x IP addresses are sent to its WAN. All other IP addresses fail with no route.

If your router doesn't give you this amount of fine control over the routing table, you might be able to set up an access or port block to everything except the 192.168.1.x subnet (Network1) over the WAN. That is, pretend the arduino devices belong to disobedient children whose devices you're trying to block from having Internet access. Same for the Raspberry Pi, except you allow that to access the 192.168.1.x subnet (or even just your PC's IP address). This would have the same effect of blocking all traffic through the WAN except that destined for 192.168.0.x.

You then set up port forwarding or DMZ on Router2 to point to the Raspberry Pi. Your PC then can then connect to the Raspberry Pi at Router2's static WAN IP address.
 
Trying to bridge the LAN of two subnets isn't going to work well. To use two subnets you need a router with VLANs, 1 for each switch.

I would suggest using just one subnet. Make the second router an access point and plug it's LAN into the switch. Turn off DHCP on the second one. If you don't need the wifi of the second router just don't use it.