# 2 nic cards with 2 providers

## xante

I have 2 ethernet cards in my box currently.  I also have 2 internet connections coming to my house.  I would like to setup eth1 as a static ip and eth2 as a dynamic ip.  First off, I can run them seperatly if eth1 is up and eth2 is down my net works and the same if eth2 is up and eth1 is down, so they are setup correctly individually, but when I startup eth1 and eth2 at the same time, my computer cant even ping google.  I would really like to understand what is going on in my configuration.

On a side note, if I can make this work I would also wonder about running specific programs on a specific card, such as a p2p program on eth1 for example and ssh on eth2.Last edited by xante on Fri May 06, 2005 10:45 pm; edited 1 time in total

----------

## nielchiano

I'll just forward you to this post: https://forums.gentoo.org/viewtopic-t-332935.html

I replied there with the exact same answer I'd give here; go check that link, for you it'll work 99%

----------

## xante

I understand everything in the following quote except what P1_NET and P2_NET should be:

 *Quote:*   

>  Let us first set some symbolical names. Let $IF1 be the name of the first interface (if1 in the picture above) and $IF2 the name of the second interface. Then let $IP1 be the IP address associated with $IF1 and $IP2 the IP address associated with $IF2. Next, let $P1 be the IP address of the gateway at Provider 1, and $P2 the IP address of the gateway at provider 2. Finally, let $P1_NET be the IP network $P1 is in, and $P2_NET the IP network $P2 is in.

 

Here is the others (with modifications to real ips):

IF1 = eth1

IF2 = eth2

IP1 = 150.34.196.80

IP2 = 122.135.210.174

P1 = 150.34.196.254

P2 = 122.135.210.254

P1_NET = ?

P2_NET = ?

----------

## nielchiano

 *xante wrote:*   

> I understand everything in the following quote except what P1_NET and P2_NET should be:
> 
>  *Quote:*    Let us first set some symbolical names. Let $IF1 be the name of the first interface (if1 in the picture above) and $IF2 the name of the second interface. Then let $IP1 be the IP address associated with $IF1 and $IP2 the IP address associated with $IF2. Next, let $P1 be the IP address of the gateway at Provider 1, and $P2 the IP address of the gateway at provider 2. Finally, let $P1_NET be the IP network $P1 is in, and $P2_NET the IP network $P2 is in. 
> 
> Here is the others (with modifications to real ips):
> ...

 

P1_NET = 150.34.196.0

P2_NET = 122.135.210.0

just AND the IP with the subnet mask and you'll get the network; AND it with NOT-subnetmask and you'll het the host-part

----------

## xante

root-bash# ip route add <$P1_NET> dev <$IF1> src <$IP1> table T1

Error: argument "T1" is wrong: "table" value is invalid

This is the error I get, am I to assume it has something to do with there being no table T1?  If this is the cause, then how do I create table T1?

Thank you kindly.

----------

## nielchiano

 *xante wrote:*   

> root-bash# ip route add <$P1_NET> dev <$IF1> src <$IP1> table T1
> 
> Error: argument "T1" is wrong: "table" value is invalid
> 
> This is the error I get, am I to assume it has something to do with there being no table T1?  If this is the cause, then how do I create table T1?
> ...

 

Did you read the link? right before the mentioned command, there is:

 *Quote:*   

> One creates two additional routing tables, say T1 and T2. These are added in /etc/iproute2/rt_tables.

 

----------

## xante

ooops, your right i should read more carefully, thanks for pointing it out.

----------

## xante

new error:

```
xante xante # ip route add 216.197.193.0 dev eth0 src 216.197.193.80 table T1

RTNETLINK answers: File exists

xante xante # 

```

Ive looked around and could only find things relating to QoS, which I do not think is the problem here.

----------

## nielchiano

 *xante wrote:*   

> new error:
> 
> ```
> xante xante # ip route add 216.197.193.0 dev eth0 src 216.197.193.80 table T1
> 
> ...

 

I don't know. maybe that route already exists?

----------

## xante

Do you know a way of checking if it does exist?

----------

## nielchiano

 *xante wrote:*   

> Do you know a way of checking if it does exist?

 

maybe ip route show... :Question: 

----------

