Problems bringing up a second virtual network interface

I'm having issues adding a second IP address to one interface. Below is my````
/etc/networking/interfaces


# The loopback network interface
    auto lo
    iface lo inet loopback

# The primary network interface
auto eth0 eth0:0 eth0:1

#eth0 is our main IP address
iface eth0 inet static
 address 198.58.103.*
 netmask 255.255.255.0
 gateway 198.58.103.1

#eth0:0 is our private address
iface eth0:0 inet static
 address 192.168.129.134
 netmask 255.255.128.0

#eth0:1 is for www.site.com
iface eth0:1 inet static
 address 198.58.104.*
 netmask 255.255.255.0
 gateway 198.58.104.1
When I run````
/etc/init.d/networking restart

, I get several errors about resolv.conf and then a fail error about bringing up eth0:1:

    resolvconf: Error: /etc/resolv.conf isn't a symlink, not doing anything.
    ssh stop/waiting
    ssh start/running, process 23229
    RTNETLINK answers: File exists
    Failed to bring up eth0:1.

Any reason this would be? I didn't have any problems with I first set up eth0 and eth0:0.

6 Replies

Remove the 'gateway' line from eth0:1.

BTW, the /etc/resolv.conf thing isn't an error, exactly. The system is just whining that automatic management of the file is disabled. If that's what you want, it's not an error.

Removed the gateway line and am still seeing the error. I've also tried manually bringing down the interfaces and then bringing them back up.

sudo ifdown eth0:1
ifdown: interface eth0:1 not configured
sudo ifup eth0:1
RTNETLINK answers: File exists
Failed to bring up eth0:1.

I rebooted and that fixed my problem…

Is there a correct way to restart networking? I was doing /etc/init.d/networking restart.

Note that a reboot is necessary to add a new IP address (this is a Linode requirement, not a Linux one).

The linode tutorial is unclear about the reboot. After adding interfaces, the tutorial says now you can ping the gateway. In fact, you won't be able to ping the second gateway until you reboot.

@Vance:

Note that a reboot is necessary to add a new IP address (this is a Linode requirement, not a Linux one).

Any reason why? A Zen thing?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct