Buscar en moleculax
Multiple static IP Debian 9 Stretch on one interface

Cannot add multiple IPs to network interface.
While trying to add an IP to the interface enp2s0 via Webmin it says:
Failed to save interface : Missing or invalid interface name
It's a known bug in Webmin, so lets skip this right now.
Modifying /etc/network/interfaces directly
auto lo
iface lo inet loopback
iface lo inet6 loopback

auto enp2s0
allow-hotplug enp2s0
iface enp2s0 inet static
  address XX.4.87.10
  netmask 255.255.255.224
  gateway XX.4.87.1
  # route XX.4.87.0/27 via XX.4.87.1
  up route add -net XX.4.87.0 netmask 255.255.255.224 gw XX.4.87.1 dev enp2s0

iface enp2s0 inet static
  address XX.4.87.47
  netmask 255.255.255.224
  gateway XX.4.87.33
  up route add -net XX.4.87.0 netmask 255.255.255.224 gw XX.4.87.33 dev enp2s0

iface enp2s0 inet static
  address XX.4.87.37
  netmask 255.255.255.224
  gateway XX.4.87.33
  up route add -net XX.4.87.0 netmask 255.255.255.224 gw XX.4.87.33 dev enp2s0

iface enp2s0 inet6 static
  address XXXX:4f8:140:701e::2
  netmask 64
  gateway fe80::1
The first (main-IP) and the second in the list are always connectable, but the third permanently not. So I'm able to switch the IPs order and can access my server after a reboot, what I'm doing wrong?
(I've also tried the legacy method of Debian Docs but this is crashing it all)
root@hdtu1 ~ # systemctl status networking.service
● networking.service - Raise network interfaces
   Loaded: loaded (/lib/systemd/system/networking.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Wed 2018-08-01 22:40:12 CEST; 7s ago
     Docs: man:interfaces(5)
  Process: 2184 ExecStart=/sbin/ifup -a --read-environment (code=exited, status=1/FAILURE)
  Process: 2179 ExecStartPre=/bin/sh -c [ "$CONFIGURE_INTERFACES" != "no" ] && [ -n "$(ifquery --read-environment --list --exclude
 Main PID: 2184 (code=exited, status=1/FAILURE)

Aug 01 22:40:12 hdtu1 systemd[1]: Starting Raise network interfaces...
Aug 01 22:40:12 hdtu1 ifup[2184]: RTNETLINK answers: File exists
Aug 01 22:40:12 hdtu1 ifup[2184]: ifup: failed to bring up enp2s0
Aug 01 22:40:12 hdtu1 systemd[1]: networking.service: Main process exited, code=exited, status=1/FAILURE
Aug 01 22:40:12 hdtu1 systemd[1]: Failed to start Raise network interfaces.
Aug 01 22:40:12 hdtu1 systemd[1]: networking.service: Unit entered failed state.
Aug 01 22:40:12 hdtu1 systemd[1]: networking.service: Failed with result 'exit-code'.

.


Powered by

http://emiliogomez.com.ar