3

Setup:

I have two computers, both with an ethernet and wireless interface.

I have router A that is connected to the internet.

I have a router B that is not connected to the internet.

I would like to connect both computers to router A wirelessly, and both computers to router B ethernetly.

Problem:

If I connect a computer to router A and router B at the same time, I no longer have internet access through router A.

Reason:

File transfers between my two computers using router A is very slow, because wireless is terrible. If I could connect both computers to the internet through router A, and both computers to each other through router B, then I could speed up file transfers between them whilst still being able to access the internet.

To my intense irritation, connecting ethernetly to a router that has internet access is not an option.

Additional info:

After connecting to routers A and B:

alyx@shire ~> route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         BTBusinessHub.h 0.0.0.0         UG    0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     1      0        0 eth0
192.168.1.0     *               255.255.255.0   U     9      0        0 wlan0

I found a previous question that seems to pose the same problem (How to set up dual wired and wireless connections?), and followed the given answer. It did not work, and I still could not connect to the internet through router A. 'route' output changed to the following:

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

1 Answers1

1

problem persist because you have the same network on both router and probably the same gateway. Change on one router configuration for lan network ex: router A lan: 192.168.2.0/24.

                                | internet
                         --------------
      |----------------- |  router A  |--------------|
      |                  --------------              |
      |                                              |
      |                 192.168.1.0/24               |
      |                                              |
ip:192.168.1.5                                 ip:192.168.1.6
  ----------                                     ----------
  |  pc 1  |                                     |  pc 2  |
  ----------                                     ----------
ip:192.168.2.5                                 ip:192.168.2.6
      |                                              |
      |                                              |
      |                192.168.2.0/24                |
      |                                              |
      |                 --------------               |
      |-----------------|  router B  |---------------|
                        --------------
                               | internet

Config example:

pc1

eth0    ip: 192.168.1.5
        nm: 255.255.255.0
        gw: 192.168.1.1

wles0   ip: 192.168.2.5
        nm: 255.255.255.0
        gw: 192.168.2.1

pc2

eth0    ip: 192.168.1.6
        nm: 255.255.255.0
        gw: 192.168.1.1

wles0   ip: 192.168.2.6
        nm: 255.255.255.0
        gw: 192.168.2.1


router A 

lan     ip: 192.168.1.1
        nm: 255.255.255.0

router B

lan     ip: 192.168.2.1
        nm: 255.255.255.0

On this way you can control path from pc1 to pc2.

Example: If you wish t access from pc1 to pc2 through router A simple access to ip: 192.168.1.6. If you wish access from pc2 to pc1 through router B hit to ip: 192.168.2.5.

Access to internet you can control with route

ip route add default gw 192.168.1.1 - for router A
ip route add default gw 192.168.2.1 - for router B

Or simple, do not use default gw on network card on with you wish to avoid access to internet.

2707974
  • 10,553
  • 6
  • 33
  • 45
  • ip route add default gw 192.168.1.1 does nothing -- the default gateway already is 192.168.1.1: default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 –  Mar 20 '15 at 09:59
  • If I disconnect the ethernet, and just leave the wireless connected, typing route shows default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 as the first line. If I connect the ethernet and the wireless, and do the steps suggested in the askubuntu question I linked so that I get default 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0 as the first line in route, yet I have no internet access. –  Mar 20 '15 at 10:04
  • Okay, you'll have to bear with me here, I don't know anything about networking really. Is the problem that under the destination column of route output that both wlan0 and eth0 are 192.168.1.0? I should change it so that one of them is 192.168.2.0? How do I do that? –  Mar 20 '15 at 10:12
  • You must log to router A or router B and change setting for network. – 2707974 Mar 20 '15 at 10:13