# Multiple Interfaces

## bma51

I've been fighting with this problem for the past few days and cannot seem to crack it.  I've read every guide I can find, every post i could find, but cannot get anywhere with it.  Here's my situation:

eth0 = private interface

eth1 = public interface

/etc/conf.d/net contains:

```
config_eth0=( "<local ip>/24" )

config_eth1=( "<public ip>/26" )

routes_eth0=( "default via <local gateway>" )

routes_eth1=( "default via <isp next hop>" )

```

routing table:

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

<public net>    *               255.255.255.192 U         0 0          0 eth1

<private net>   *               255.255.255.0   U         0 0          0 eth0

loopback        *               255.0.0.0       U         0 0          0 lo

default         <priv gateway>  0.0.0.0         UG        0 0          0 eth0

default         <pub gateway>   0.0.0.0         UG        0 0          0 eth1

```

The internal interface works fine; all services come up and are accessible.  However, the pubic does not work at all.  I cannot ping it from the outside world and if I try to ping its DG from the machine, I get no replies.  If i try to ping another public machine I get:

```
From <public ip> icmp_seq=2 Destination Host Unreachable
```

Anybody got any ideas for what may be going on?  I'm hoping is something simple that I am just overlooking.

----------

## Sleipnir

I think you routing table is wrong. It should look like the following:

```

Kernel IP routing table 

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface 

<public net>    <pub gateway>   255.255.255.192 U         0 0          0 eth1 

<private net>   *               255.255.255.0   U         0 0          0 eth0 

loopback        *               255.0.0.0       U         0 0          0 lo 

default         <priv gateway>  0.0.0.0         UG        0 0          0 eth0 

```

or 

```

Kernel IP routing table 

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface 

<public net>    *              255.255.255.192 U         0 0          0 eth1 

<private net>   <priv gateway> 255.255.255.0   U         0 0          0 eth0 

loopback        *              255.0.0.0       U         0 0          0 lo 

default         <pub gateway>  0.0.0.0         UG        0 0          0 eth1

```

----------

## bma51

thanks for the reply, but it still is not working.  i got the physical interfaces switched and now have the same problem, but with the internal interface.  i'm leaning towards something is wrong with the NIC / driver / etc.  I need to check my kernel config to see what's wrong.

----------

## gentoo_ram

It's not clear from your post what you did to "fix" it.  Please post your routing table again.  To be more clear, there should only be one default route  If there is more than one, it isn't correct.

----------

## bma51

i have not gotten a fix yet.

Here's what I did though, i matched my route table to the ones suggested by Sleipnir and was still unable to use both interfaces.  So, to rule out a hardware problem, i switched the interfaces, moved eth0 to be the external and eth1 to be the internal.  now my problem existed but was reversed; public facing services function, but internal services do not.  out of curiosity, i switched the internal interface from static to DHCP just to see what happens.  I have the same problem, external services are functional, internal are not.

i just booted off the live CD to see what modules were detected / loaded and cannot find a difference.  My server is the following:

Sun Fire x2100

eth0 = Broadcom NeteXtreme (tg3)

eth1 = NForce CK804 (forcedeth)

uname

```
Linux xxx 2.6.22-gentoo-r8 #7 Fri Oct 26 14:32:38 EDT 2007 x86_64 AMD Opteron(TM) Processor 148 AuthenticAMD GNU/Linux
```

I am at a complete loss with this problem...

----------

## Sleipnir

Please post the output of the following commands:

```

ifconfig

route -n

```

----------

## bma51

Current configuration:

eth0 = public interface

eth1 = private interface (dhcp) -- temporary (will have a static address once its working properly)

ifconfig

```
eth0      Link encap:Ethernet  HWaddr 00:E0:81:5E:43:95

          inet addr:<public ip>  Bcast:<public broadcast>  Mask:255.255.255.224

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:18031 errors:0 dropped:0 overruns:0 frame:0

          TX packets:638 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:1277345 (1.2 Mb)  TX bytes:77308 (75.4 Kb)

          Interrupt:19

eth1      Link encap:Ethernet  HWaddr 00:E0:81:5E:43:94

          inet addr:169.254.55.45  Bcast:169.254.255.255  Mask:255.255.0.0

          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

          RX packets:114152 errors:0 dropped:0 overruns:0 frame:0

          TX packets:35107 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:1000

          RX bytes:11695733 (11.1 Mb)  TX bytes:7763332 (7.4 Mb)

          Interrupt:23 Base address:0xa000

lo        Link encap:Local Loopback

          inet addr:127.0.0.1  Mask:255.0.0.0

          UP LOOPBACK RUNNING  MTU:16436  Metric:1

          RX packets:0 errors:0 dropped:0 overruns:0 frame:0

          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0

          collisions:0 txqueuelen:0

          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

```

route -n

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

<pub network>   0.0.0.0         255.255.255.224 U     0      0        0 eth0

169.254.0.0     0.0.0.0         255.255.0.0     U     1      0        0 eth1

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

0.0.0.0         <public gtwy>   0.0.0.0         UG    0      0        0 eth0

```

/etc/conf.d/net

```
## address assignment ##

config_eth0=( "<public ip>/26" )

config_eth1=( "dhcp" )

## route entries ##

routes_eth0=( "default via <public gatway>" )

```

----------

## Sleipnir

The IP of eth1 seems to be in the zeroconf range, meaning this device probably got no IP from your dhcp server. Try to set the IP of eth1 by hand!

For only changing the IP temporary do

```

ifconfig eth1 <free ip in private network> netmask 255.255.255.0 up

```

This change doesn't survive a new boot.  :Wink:  Change back to dhcp by

```

dhcpcd eth1

```

if you are using dhcpcd as your dhcp client.

----------

## bma51

 *Sleipnir wrote:*   

> The IP of eth1 seems to be in the zeroconf range, meaning this device probably got no IP from your dhcp server. Try to set the IP of eth1 by hand!
> 
> For only changing the IP temporary do
> 
> ```
> ...

 

With the IP address manually set, I try to ping another internal machine and I get :

```
PING <another ip> (<another ip>) 56(84) bytes of data.

From <private ip> icmp_seq=1 Destination Host Unreachable

From <private ip> icmp_seq=2 Destination Host Unreachable

From <private ip> icmp_seq=3 Destination Host Unreachable

From <private ip> icmp_seq=4 Destination Host Unreachable

From <private ip> icmp_seq=5 Destination Host Unreachable

From <private ip> icmp_seq=6 Destination Host Unreachable

--- <another ip> ping statistics ---

7 packets transmitted, 0 received, +6 errors, 100% packet loss, time 6018ms, pipe 3
```

----------

## Sleipnir

Can you please confirm that eth1 now has a IP of your private network

and the netmask is correct! If so than please repost your routing table.

Btw: Could you please test (maybe with another computer) if the internal

network is reachable from the machine's switch port, just to eliminate

the possibility of a switch hardware failure.

----------

## bma51

1) eth1 with private ip & correct netmask...DONE

2) my new routing table...

```
Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

<public net>    0.0.0.0         255.255.255.192 U     0      0        0 eth0

<private net>   0.0.0.0         255.255.255.0   U     0      0        0 eth1

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

0.0.0.0         <public gtwy>   0.0.0.0         UG    0      0        0 eth0

```

3) change internal switch ports...DONE

I am still sitting in the same situation here.  Only one interface works.  No matter if i use internal or external on the nForce NIC, it just will not work.  NIC functioned fine with the same config, but under Windows before I put Gentoo on it.

----------

## Sleipnir

In your original posting you mentioned a public and a private gateway. So do you also need a gateway on eth1?

If you plug a crosslink cable into the nForce NIC and connect it to another computer are you able to ping the nForce form the other computer?

If so, only the routing table is incorrect, else we have to find the reason why this NIC isn't working, even if gentoo thinks it is.

Btw: do you find something concerning the network traffic on eth1 in the logfiles (/var/log/*)?

----------

## gcombe74

you might have to turn on routing in the kernel.  i am not sure... i have a similar issue..but I am running 2 copper nics and one fiber... I dont really want them to route as you do... i just cannot get them to do dns or forward queries... but I can ssh to my box via the interface that I want...    

anyhow just a thought?

----------

## bma51

i had to scrap this system because of the routing problem it was having.  i could not get ANY NIC to come up properly as another interface.  i built another machine in its place on different hardware with no problem.  if i come across a solution for this in testing later, i will post it here.

thanks to those who tried with this.  it was appreciated.

----------

