Score:0

How to define multiple interfaces which are in the same subnet

ss flag

In my setup I have a Zabbix Server on a Hyper-V Ubuntu Server 22.04 LTS VM which is running on Server A. The Ubuntu Server has two virtual interfaces of which each is associated to one physical interface.

Both interfaces are in the same subnet; one is connected to an RMC Port (of Server B) and the other is connected to a normal LAN port of Server B.

This is the current netplan (of the Zabbix Server):

network:
  ethernets:
    # 1st network interface                              - Goes to RMC
    eth0: 
      dhcp4: false
      addresses: [10.100.100.4/28]                      
      # routes:
      # - to: 10.100.100.12/28
      #   via: 10.100.100.11/28
    # 2nd network interface                              - Goes to standard LAN port
    eth1:
      dhcp4: false
      addresses: [10.100.100.8/28]
      routes:
      - to: 0.0.0.0/0
        via: 10.100.100.11/28

The problem now is, that I can only fetch data over one port at a time.

  • If I only define interface eth1, I can fetch data from Server B.
  • If I define both interfaces with or without routes, I can fetch data from RMC but not from Server B. I can ping the Zabbix Server from Server B, but I can't connect to it (open the web dashboard).

Therefore I'm guessing, that if the Zabbix Server receives data, it is confused and doesn't know over which interface it should respond. I've started reading about routing-policy but it seems like it is used when having two IPs on the same interface.

Am I completely misunderstanding something or what am I missing?

us flag
You have successfully defined two network interfaces in the same subnet. What is not clear is why you are doing this or how you are expecting it to work. It is precisely by defining separate networks with different addresses that we normally define how network traffic is supposed to flow. If what you want is for your Ubuntu server to respond to traffic on the same interface it came in, then that would be a routing policy.
Score:0
uy flag

There are multiple ways of configuring multiple “interfaces” into the same subnet. Right now I do not know why you want to do this:

Option 1) use of multiple IP addresses of a subnet Netplan would look like

network:
  ethernets:
    # 1st network interface
    eth0: 
      dhcp4: false
      addresses: 
        - 10.100.100.4/28
        - 10.100.100.8/28
      routes:
      - to: 0.0.0.0/0
        via: 10.100.100.11/28

Option 2) (your usecase) use of multiple Interfaces within a subnet: Setup a Bridge, assign an IP Address (routing) to the Bridge and add eth0 and eth1 to the bridge.

network:
  version: 2
    renderer: networkd
    ethernets:
      eth0:
        dhcp4: no
      eth1:
        dhcp4: no
    
    bridges:
      br0:
        dhcp4: no
        addresses: 
          - 10.100.100.4/28
        routes:
          - to: 0.0.0.0/0
            via: 10.100.100.11/28
    
        interfaces:
          - eth0
          - eth1

Option 3)

use of Bonding – see netplan documentation https://netplan.io/examples I guess you will be happy with a bridge, but I do not know the configuration of the Zabbix server interfaces.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.