0

I need to setup on my VPS a failover IP address for my main ethernet interface.

I can find any kind of guide/tutorial for Debian 7 and 8 but they just won't work for Debian 9 (Stretch) since something about network interfaces changed in this version.

OVH's Configure a failover IP with Debian instructions is one such guide, which I have been following. I edited /etc/network/interfaces:

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug ens4
iface ens4 inet dhcp

auto ens4:0
iface ens4:0 inet static
address -IP i won't type on pastebin-
netmask 255.255.255.255
broadcast -same IP as before-

Restarting the networking service yielded these messages in the log:

gen 25 11:37:26 vps370990 ifup[15870]: DHCPACK of MY_VPS_IP from DHCP_SERVER_IP.
gen 25 11:37:26 vps370990 ifup[15870]: bound to MY_VPS_IP -- renewal in 34720 seconds.
gen 25 11:37:26 vps370990 ifup[15870]: Cannot find device "ens4:0"
gen 25 11:37:26 vps370990 ifup[15870]: ifup: failed to bring up ens4:0
gen 25 11:37:27 vps370990 systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
gen 25 11:37:27 vps370990 systemd[1]: Failed to start Raise network interfaces.
gen 25 11:37:27 vps370990 systemd[1]: networking.service: Unit entered failed state.
gen 25 11:37:27 vps370990 systemd[1]: networking.service: Failed with result 'exit-code'.

How can I do this?

10
  • 1
    Please detail what you have done and what you need exactly. Commented Jan 25, 2018 at 18:39
  • Are you looking for bounding setup ?
    – francois P
    Commented Jan 25, 2018 at 18:46
  • @RuiFRibeiro I'm trying to achieve exactly this : ovh.com/world/g2042.configure_a_failover_ip_with_debian but on Debian Stretch. What I did is simply following the istructions - and I suppose correctly, since the guys from that website confirmed me that "this contain an error if applied on Debian 9 but works on Debian 8"
    – qwert
    Commented Jan 25, 2018 at 19:05
  • @francoisP I'm sorry but I don't know if that's what I need. Basically the company which provides me this VPS activated an additional IP as I requested. Now I simply want to configure the network interface I already use to make use of both the old and the new IPs, to subsequently set through a cpanel-like panel the new IP as dedicated IP to a website, and leave all the other websites listening on the old IP. The guide I tried following is on my above comment
    – qwert
    Commented Jan 25, 2018 at 19:10
  • 1
    Please detail what you did in your own question exactly and not sending some random link here. Commented Jan 25, 2018 at 19:17

2 Answers 2

1

On debian 9 I added a failover IP like this:

backup old conf

cp /etc/systemd/network/50-default.network /etc/systemd/network/50-default.network.bak

edit the network file

vim /etc/systemd/network/50-default.network

add the new [Address] block (1 per IP Address)

[Address]
Address=139.130.4.5/32
[Address]
Address=138.131.5.6/32

Now restart

systemctl restart systemd-networkd
0

From the comments:

@RuiFRibeiro ok, for some reason I cannot understand yet the logical network device name is not "ens4" but "ens3", even if it's called ens4 in the interfaces settings file. Indeed I see ens3 using both "ifconfig" and "lshw -C network | grep 'logical name'". I edited my interfaces file leaving the ens4 part as it is with dhcp and assigning my new IP to ens3:0 and it works. -- qwert

Actually, the ens4 lines in /etc/network/interfaces are probably completely non-functional, and the main ens3 interface is getting configured by NetworkManager using its default setting - which is to use DHCP.

ens4 would explicitly refer to NIC in PCIe hotplug slot #4 and ens3 likewise to PCIe hotplug slot #3. So if there is no NIC in slot #4, that's why the

allow-hotplug ens4
iface ens4 inet dhcp

lines are getting ignored.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .