Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a Ubuntu 10.04 LTS Server which has two Ethernet ports eth0 and eth1.

  • eth0 is connected to ISP1 with network 192.168.3.0/24 with server static address 192.168.3. 5

  • eth1 is connected to ISP2 with network 192.168.5.0/24 with server static address 192.168.5.10

When eth1 is connected, there is no internet connection from eth0. The internal network is accessible, eg, ssh , ping from other computers in 192.168.3.0/24 network.

When eth1 is disabled or disconnected, eth0 works just fine.

How can I ensure that both the Ethernet ports get internet connections?

netstat configs eth1 disabled

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

192.168.3.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

0.0.0.0         192.168.3.1     0.0.0.0         UG        0 0          0 eth0

Netstat config eth1 enabled

Kernel IP routing table

Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface

192.168.3.0     0.0.0.0         255.255.255.0   U         0 0          0 eth0

192.168.5.0     0.0.0.0         255.255.255.0   U         0 0          0 eth1

0.0.0.0         192.168.5.254   0.0.0.0         UG        0 0          0 eth1

0.0.0.0         192.168.3.1     0.0.0.0         UG        0 0          0 eth0

Edit

I have also checked /etc/resolv.conf

There, I have manually added the nameserver for both the gateways.

ip addr show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
    link/ether 11:bb:3e:15:3e:0e brd ff:ff:ff:ff:ff:ff
    inet 192.168.3.100/24 brd 192.168.3.255 scope global eth0
           valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 100
    link/ether aa:2a:ae:5f:59:e8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.5.100/24 brd 192.168.5.255 scope global eth1
           valid_lft forever preferred_lft forever
share|improve this question
2  
Can you run route -n, both with eth0 enabled and with eth0 disabled, and add that to your question? It will both help visualize things and maybe spot problem areas. –  roadmr Aug 1 '12 at 13:09
    
@roadmr: done as requested. –  Ubuntuser Aug 1 '12 at 15:53
    
anyone got any suggestions? –  Ubuntuser Aug 6 '12 at 10:27
    
How are you testing that the internet is/isn't working on eth0? My suspicion is that, because both eth0 & eth1 have the same priority, the system is preferring to send packets on eth1. From your route table, anywhere other than the 2 local networks should be accessible from either gateway, so when a connection is received from the internet on eth0, the system sends the reply on eth1, expecting that it will get there. In theory, this should work. But if certain addresses can only be accessed via a particular ISP, you will need to add explicit routing. –  StarNamer Aug 6 '12 at 17:07
    
i tested by taking out the ethernet cable. once eth1 was taken out, eth0 had no connection –  Ubuntuser Aug 7 '12 at 23:26

2 Answers 2

up vote 4 down vote accepted

I made a possible running example based on the basic implementation (of Split access) taken from here.

Create two additional routing tables, say T1 and T2.

ip route add 192.168.3.0/24 dev eth0 src 192.168.3.5 table T1
ip route add default via 192.168.3.0/24 table T1
ip route add 192.168.5.0/24 dev eth1 src 192.168.5.10 table T2
ip route add default via 192.168.5.0/24 table T2

Set up the main routing table:

ip route add 192.168.3.0/24 dev eth0 src 192.168.3.5
ip route add 192.168.5.0/24 dev eth1 src 192.168.5.10

Add your preference for default route:

ip route add default via 192.168.3.5

Set up the routing rules, choose what routing table to route with.

ip rule add from 192.168.3.5 table T1
ip rule add from 192.168.5.10 table T2

More info here.

share|improve this answer
    
thanks for your reply. but even after doing that, i get this 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000 for eth0. Should the state be UNKNOWN ? –  Ubuntuser Aug 30 '12 at 12:57
    
@Ubuntuser - Disable the network manager or anything that could control these interfaces. Do you get the same error? –  pl1nk Aug 30 '12 at 13:30
    
its a headless server with no gui installed, there is no network manager . –  Ubuntuser Sep 1 '12 at 12:20
    
@Ubuntuser - Purge all IP configuration of the interfaces with ip addr flush eth0 && ip addr flush eth1 and retry. Some useful info here. –  pl1nk Sep 2 '12 at 12:56
    
thanks. its not the perfect solution but I will take it. It works sometimes and other times it does not. But after research I found out thats the best I can get from this type of load balancing. –  Ubuntuser Sep 27 '12 at 11:58

Check out that both ports are up. Reconfigure eth1, eth0 as always up.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.