How do I set additional IP addresses on an existing interface in Debian 9?











up vote
0
down vote

favorite












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?










share|improve this question
















bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    Please detail what you have done and what you need exactly.
    – Rui F Ribeiro
    Jan 25 at 18:39












  • Are you looking for bounding setup ?
    – francois P
    Jan 25 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
    Jan 25 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
    Jan 25 at 19:10






  • 1




    Please detail what you did in your own question exactly and not sending some random link here.
    – Rui F Ribeiro
    Jan 25 at 19:17















up vote
0
down vote

favorite












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?










share|improve this question
















bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.











  • 1




    Please detail what you have done and what you need exactly.
    – Rui F Ribeiro
    Jan 25 at 18:39












  • Are you looking for bounding setup ?
    – francois P
    Jan 25 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
    Jan 25 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
    Jan 25 at 19:10






  • 1




    Please detail what you did in your own question exactly and not sending some random link here.
    – Rui F Ribeiro
    Jan 25 at 19:17













up vote
0
down vote

favorite









up vote
0
down vote

favorite











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?










share|improve this question















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?







debian networking network-interface






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 26 at 8:07









JdeBP

31.5k466147




31.5k466147










asked Jan 25 at 18:38









qwert

11




11





bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







bumped to the homepage by Community 2 days ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.










  • 1




    Please detail what you have done and what you need exactly.
    – Rui F Ribeiro
    Jan 25 at 18:39












  • Are you looking for bounding setup ?
    – francois P
    Jan 25 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
    Jan 25 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
    Jan 25 at 19:10






  • 1




    Please detail what you did in your own question exactly and not sending some random link here.
    – Rui F Ribeiro
    Jan 25 at 19:17














  • 1




    Please detail what you have done and what you need exactly.
    – Rui F Ribeiro
    Jan 25 at 18:39












  • Are you looking for bounding setup ?
    – francois P
    Jan 25 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
    Jan 25 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
    Jan 25 at 19:10






  • 1




    Please detail what you did in your own question exactly and not sending some random link here.
    – Rui F Ribeiro
    Jan 25 at 19:17








1




1




Please detail what you have done and what you need exactly.
– Rui F Ribeiro
Jan 25 at 18:39






Please detail what you have done and what you need exactly.
– Rui F Ribeiro
Jan 25 at 18:39














Are you looking for bounding setup ?
– francois P
Jan 25 at 18:46




Are you looking for bounding setup ?
– francois P
Jan 25 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
Jan 25 at 19:05




@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
Jan 25 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
Jan 25 at 19:10




@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
Jan 25 at 19:10




1




1




Please detail what you did in your own question exactly and not sending some random link here.
– Rui F Ribeiro
Jan 25 at 19:17




Please detail what you did in your own question exactly and not sending some random link here.
– Rui F Ribeiro
Jan 25 at 19:17










2 Answers
2






active

oldest

votes

















up vote
0
down vote













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.






share|improve this answer




























    up vote
    0
    down vote













    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





    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "106"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f419674%2fhow-do-i-set-additional-ip-addresses-on-an-existing-interface-in-debian-9%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      0
      down vote













      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.






      share|improve this answer

























        up vote
        0
        down vote













        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.






        share|improve this answer























          up vote
          0
          down vote










          up vote
          0
          down vote









          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.






          share|improve this answer












          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.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Jan 26 at 10:24









          telcoM

          14.2k11842




          14.2k11842
























              up vote
              0
              down vote













              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





              share|improve this answer

























                up vote
                0
                down vote













                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





                share|improve this answer























                  up vote
                  0
                  down vote










                  up vote
                  0
                  down vote









                  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





                  share|improve this answer












                  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






                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Apr 12 at 7:05









                  Spir

                  1011




                  1011






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f419674%2fhow-do-i-set-additional-ip-addresses-on-an-existing-interface-in-debian-9%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Entries order in /etc/network/interfaces

                      新発田市

                      Grub takes very long (several minutes) to open Menu (in Multi-Boot-System)