4

I am having issues configuring three blocks on my system. I used to add the addresses of each block manually, but I discovered that I can add the entire block using the command "ip route add local". When I tried this, it initially worked, but when I attempted to configure the last block, it stopped working. Now, when I try to restart the service, the interface fails to start and the block does not respond to pings or allow connections when using the interface, even after rebooting.

Solutions attempted:

  • ip addr flush enp1s0f0 - This disconnects my SSH connection.
  • ip addr flush enp1s0f0 && ifup enp1s0f0; echo done && sleep 20 && reboot - This just cuts my connection and reboots the system, indicating that the "ifup" command still did not work.

Interfaces file:

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug enp1s0f0

auto enp1s0f0
iface enp1s0f0 inet static
    address 84.x.x.74/29
    gateway 84.x.x.73
    # dns-* options are implemented by the resolvconf package, if installed
    dns-nameservers 8.8.8.8

auto enp1s0f0:0
iface enp1s0f0:0 inet static
    address 45.x.x.2/22
    gateway 45.x.x.1

auto enp1s0f0:1
iface enp1s0f0:1 inet static
    address 196.x.x.2/24
    gateway 196.x.x.1

auto enp1s0f0:2
iface enp1s0f0:2 inet static
    address 196.x.x.2/24
    gateway 196.x.x.1

The interfaces ":1" and ":2" refer to two different IP blocks, such as "196.12.12.1" and "196.13.13.1". Can you please provide guidance on how to address the issue with configuring these blocks?

7
  • 3
    the :1 and :2 interfaces seem to have the same gateway and ip, this won't workk
    – stoney
    Jan 8, 2020 at 12:49
  • @stoney They are different blocks, eg 196.12.12.1 & 196.13.13.1
    – Monstrum
    Jan 9, 2020 at 1:31
  • does it work without the last gateway line ? also apparently /etc/network/interfaces.d/* does not support multiple gateways
    – intika
    Jan 9, 2020 at 1:54
  • @intika I don’t understand, it would be different interfaces though
    – Monstrum
    Jan 9, 2020 at 1:55
  • 1
    yes indeed, but this is handled as "the default gateway" so when you set it multiple time it's not accepted... you may use some routing rules to enforce the other gateways
    – intika
    Jan 9, 2020 at 1:57

1 Answer 1

5
+50

This issue can have multiple sources:

  • First you can not have the same IP on multiple interfaces

  • /etc/network/interfaces.d/* config file can contain only one single gateway because this determine the default route.

  • ip addr flush interface-name this can be helpful on such case.

  • The drivers of the required network interface must be available at the Kernel level, as module or directly included.

  • Setting a proper network mask

  • etc.

The gateway:

The gateway set on the config file /etc/network/interfaces.d/* means "default gateway" and thus a default route using that gateway is generated (making one of our interface act as default interface for the machine's traffic)

As we can not set multiple gateways on the config file. We use the routing table to manage the traffic flow and set what goes over what network interface, we can for instance use fwmark and a set of rules to achieve the needed config. (this question explain in detail how to do that)

1
  • Note that some of the listed situations does not apply to your config like "same ip", "network mask" or "drivers" but i still listed them for a general serving purpose of this answer
    – intika
    Jan 9, 2020 at 12:15

You must log in to answer this question.

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