# How to directly connect two PC's with different ISPs?

## Negated Void

I've got two PC's next to one another, but they've got different internet connections. I'd like to set it up so that they know eachother's IP addresses and when they would be connecting to one another, they instead use an ethernet cable directly between them. Is this possible? How would I go about doing it  :Smile: 

Thank!

----------

## mark_lagace

If you have an available ethernet port on each machine, you could run a cross-over ethernet cable between the two of them (or hook them both up to a small hub/swtich with standard ethernet cables). Then it's just a matter of setting up a manual IP address in the same subnet for both of them and setting the route:

e.g

computer 1:

 /sbin/ifconfig ethX 192.168.0.1 up

 /sbin/route add 192.168.0.2 ethX

computer 2

 /sbin/ifconfig ethX 192.168.0.2 up

 /sbin/route add 192.168.0.1 ethX

----------

## Negated Void

Will they have to connect to one another with the local IPs that that gives them? Or can I add the route so it will happen when it uses the public ip's?

----------

## r3tep

 *Negated Void wrote:*   

> Will they have to connect to one another with the local IPs that that gives them? Or can I add the route so it will happen when it uses the public ip's?

 

Sorry, I did not understand what you are asking for?

If you set a static route, this route will be added to the route-table. Enter route in a terminal to get your current routes.

For i.e. I have this:

```
# route

Kernel IP Routentabelle

Ziel            Router          Genmask         Flags Metric Ref    Use Iface

172.16.96.0     *               255.255.255.0   U     0      0        0 vmnet8

192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0

loopback        *               255.0.0.0       U     0      0        0 lo

default         Router          0.0.0.0         UG    0      0        0 wlan0
```

And executing:

```
# /sbin/ifconfig eth0 192.160.0.1 up

# /sbin/route add 192.160.0.2 eth0
```

will give this result

```

bigbox /etc # route

Kernel IP Routentabelle

Ziel            Router          Genmask         Flags Metric Ref    Use Iface

192.160.0.2     *               255.255.255.255 UH    0      0        0 eth0

192.160.0.0     *               255.255.255.0   U     0      0        0 eth0

172.16.96.0     *               255.255.255.0   U     0      0        0 vmnet8

192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0

loopback        *               255.0.0.0       U     0      0        0 lo

default         Router          0.0.0.0         UG    0      0        0 wlan0
```

If you'll (not you. Your computer  :Wink: ) would like to send something, the software goes from the top-line to the end-line. If something cannot be reached, it'll go to the next line.

If you have this:

```
192.160.0.2     *               255.255.255.255 UH    0      0        0 eth0

default         Router          0.0.0.0         UG    0      0        0 wlan0
```

First try is 192.160.0.2. Can't reach? -> default.

You can set the LAN at both systems and LAN will be used if wired. If not wired, the connection goes through the internet.

----------

