Trying to configure eth0 and eth1 but Failed to bring up eth1

224,943

Solution 1

I think you only need one default gateway. You have set up 3: gateway 172.19.20.185, gateway 172.18.182.1 and up route add default gw 172.18.182.1 dev eth1.

Try the following interfaces file:

auto eth0 eth1

iface eth0 inet static
  address 172.19.20.186
  netmask 255.255.255.252

iface eth1 inet static
  address 172.18.182.55
  netmask 255.255.254.0
  gateway 172.18.182.1
  up route add -net 172.19.26.0/23 gw 172.19.20.185 dev eth0
  up route add -net 172.19.24.0/23 gw 172.19.20.185 dev eth0

EDIT: Try this to manually configure the interfaces, so we can see where is the error.

  1. Shut down all interfaces: ifconfig eth0 down; ifconfig eth1 down; ifconfig eth2 down; ifconfig eth3 down
  2. Configure eth0: ifconfig eth0 172.19.20.186 netmask 255.255.255.252 up
  3. Configure eth1: ifconfig eth1 172.18.182.55 netmask 255.255.254.0 up
  4. Set up default gateway: route add default gw 172.18.182.1
  5. Set up first static route: route add -net 172.19.26.0/23 gw 172.19.20.185 dev eth0
  6. Set up second static route: route add -net 172.19.24.0/23 gw 172.19.20.185 dev eth0

Solution 2

Sometimes flushing the interface before bringing it up works:

ip addr flush dev enp2s0
Share:
224,943
Test1234
Author by

Test1234

Updated on September 18, 2022

Comments

  • Test1234
    Test1234 over 1 year

    Trying to do below on Ubuntu 12.04.

    Trying to configure eth0 and eth1, eth0 works fine, but failed to bring eth1.

    Below is the settings /etc/network/interfaces:

    auto eth0 eth1
    
    iface eth0 inet static
    address 172.19.20.186
    netmask 255.255.255.252
    network 172.19.20.184
    broadcast 172.19.20.187
    gateway 172.19.20.185
    
    iface eth1 inet static
    address 172.18.182.55
    netmask 255.255.254.0
    gateway 172.18.182.1
    
    up route add -net 172.19.26.0/23 gw 172.19.20.185 dev eth0
    up route add -net 172.19.24.0/23  gw 172.19.20.185 dev eth0
    up route add default  gw 172.18.182.1 dev eth1
    

    When /etc/init.d/networking restart is done, giving below error:

    $ /etc/init.d/networking restart
    RTNETLINK answers: File exists
    Failed to bring up eth1
    

    Even ifdown eth1 and ifup eth1 giving above error.

    Can anyone help how to resolve this?

  • Test1234
    Test1234 almost 11 years
    Thanks for you response back. Tried the option that you provided, but still it is giving the same error. Is there any drivers need to be installed for eth1
  • Test1234
    Test1234 almost 11 years
    Yes eth1 is there and also eth2 and eth3 is also there. If trying to configure eth2 and eth3 instead of eth1 it is giving the same error. Below is the snapshot for ifconfig -a eth1 eth1 Link encap:Ethernet HWaddr 6c:3b:e5:b1:40:4d inet addr:172.18.182.55 Bcast:172.18.183.255 Mask:255.255.254.0 inet6 addr: fe80::6e3b:e5ff:feb1:404d/64 Scope:Link
  • Test1234
    Test1234 almost 11 years
    ifup and ifdown is showing the same error......ipconfig -a for eth2 and eth3 is below....eth2 Link encap:Ethernet HWaddr 6c:3b:e5:b1:40:4e BROADCAST MULTICAST MTU:1500 Metric:1...... eth3 Link encap:Ethernet HWaddr 6c:3b:e5:b1:40:4f BROADCAST MULTICAST MTU:1500 Metric:1 ........Resart the sever but still same issue
  • Test1234
    Test1234 almost 11 years
    1.Shut down all interfaces: ifdown eth0 eth1 eth2 eth3 For this step it is giving below error...... ifdown: interface eth1 not configured ifdown: interface eth2 not configured ifdown: interface eth3 notconfigured ......for other step 2 to step 6 it is not giving any error
  • Test1234
    Test1234 almost 11 years
    Excellent...tried to connect the ip address and it is working, problem got solved...thanks a bunch, you steps helped in solving the problem
  • SkyRaT
    SkyRaT about 7 years
    Since I was messing with routes, it possibly hung somewhere and this one-liner solved the thing entirelly. Thanks.
  • Will
    Will almost 5 years
    Genius! Once I ensured that I had only ONE gateway line in /etc/network/interfaces, my second NIC came up and down just fine using ifup and ifdown.