# Debian 12 (from marketplace) netplan does not apply context with netplan

**URL:** <https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008>\
**Category:** Product Support\
**Created:** [April 2, 2024, 3:18pm UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008 "2024-04-02T15:18:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![leandroramos](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/leandroramos/32/7598_2.png) [@leandroramos](https://forum.opennebula.io/u/leandroramos)\
**Post date:** [April 2, 2024, 3:18pm UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008/1 "2024-04-02T15:18:20Z")

</div>

I have 2 VMs, Debian 11 and Debian 12, both from OpenNebula Public Marketplace.  
Both VMs have 2 NICs (public and private bridges which are not the problem here).

I have configured public IPs on both VMs.

The context generated /etc/network/interfaces in Debian 11 works fine, with all routes working. But the context generated /etc/netplan/50-cloud-init.yaml does not work and I end with a system with no default route.

I have done nothing, just selected the virtual networks to instance both VMs. I can’t understand wtf is going on with netplan in OpenNebula’s Debian 12 image (an why tf they use netplan).

Can you help me?

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/4/4992d245005d952acaf451fad987a296c7640672.png)

![image](https://canada1.discourse-cdn.com/flex031/uploads/opennebula/original/2X/8/813501217ce87cadf818a244cdb7aabe28c0820d.png)

---

<div class="post-metadata">

**Author:** ![leandroramos](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/leandroramos/32/7598_2.png) [@leandroramos](https://forum.opennebula.io/u/leandroramos)\
**Post date:** [April 3, 2024, 4:33pm UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008/2 "2024-04-03T16:33:39Z")

</div>

Checking /var/log/syslog, if I have only public NIC/Network: no ip route at all.

Checking /var/log/syslog, if I have both public and private NIC/Network: Error: Conflicting default route declarations for IPv4 (table: main, metric: 0), first declared in eth1 but also in eth0.

Is there any known issue in one-context netplan config? There are no errors when I’m using /etc/network/interfaces in Debian 11, for example, and I guess it’s not a netplan issue.

---

<div class="post-metadata">

**Author:** ![leandroramos](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/leandroramos/32/7598_2.png) [@leandroramos](https://forum.opennebula.io/u/leandroramos)\
**Post date:** [April 3, 2024, 4:40pm UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008/3 "2024-04-03T16:40:59Z")

</div>

Here is the /etc/netplan/50-one-context.yaml generated by one-context:

```auto
# Generated by one-context
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - <public-ip>/32
      routes:
        - to: "0.0.0.0/0"
          via: <public-gateway>
          metric: 0
    eth1:
      addresses:
        - 10.10.114.160/16
      routes:
        - to: "0.0.0.0/0"
          via: 10.10.114.1
          metric: 0

```

Here is the default route after the “Error: Conflicting default route declarations for IPv4 (table: main, metric: 0), first declared in eth1 but also in eth0”:

```auto
default via 10.10.114.1 dev eth1 proto static 
10.10.0.0/16 dev eth1 proto kernel scope link src 10.10.114.160

```

I can’t get the ip route from my public NIC, even if I start the VM only with public NIC.

---

<div class="post-metadata">

**Author:** ![leandroramos](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/leandroramos/32/7598_2.png) [@leandroramos](https://forum.opennebula.io/u/leandroramos)\
**Post date:** [April 3, 2024, 6:06pm UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008/4 "2024-04-03T18:06:43Z")

</div>

I changed NETCFG\_TYPE following rollback instructions found in the [one-apps releases page](https://github.com/OpenNebula/one-apps/releases) to get it working in Debian 12 cloud image.

`NETCFG_TYPE="interfaces"`

Even though this solved the route problem, the problem between one-context and netplan remains.

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [April 5, 2024, 3:39pm UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008/5 "2024-04-05T15:39:16Z")

</div>

Can you send the VM instance template for this debian 12 issue to see if we can reproduce it ?

---

<div class="post-metadata">

**Author:** ![leandroramos](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/leandroramos/32/7598_2.png) [@leandroramos](https://forum.opennebula.io/u/leandroramos)\
**Post date:** [April 5, 2024, 3:58pm UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008/6 "2024-04-05T15:58:17Z")

</div>

The image used is Debian 12 from OpenNebula Marketplace (Apps section). Now it’s working fine using old /etc/network/interfaces and ifupdown.

Template (excluding NETCFG\_TYPE = “interfaces” line):

AUTOMATIC\_DS\_REQUIREMENTS = “("CLUSTERS/ID" @\> 100)”  
AUTOMATIC\_NIC\_REQUIREMENTS = “("CLUSTERS/ID" @\> 100)”  
AUTOMATIC\_REQUIREMENTS = “(CLUSTER\_ID = 100) & !(PUBLIC\_CLOUD = YES) & !(PIN\_POLICY = PINNED)”  
CONTEXT = [  
DISK\_ID = “1”,  
ETH0\_DNS = “8.8.8.8 8.8.4.4”,  
ETH0\_EXTERNAL = “”,  
ETH0\_GATEWAY = “”,  
ETH0\_IP = “”,  
ETH0\_IP6 = “”,  
ETH0\_IP6\_GATEWAY = “”,  
ETH0\_IP6\_METHOD = “”,  
ETH0\_IP6\_METRIC = “”,  
ETH0\_IP6\_PREFIX\_LENGTH = “”,  
ETH0\_IP6\_ULA = “”,  
ETH0\_MAC = “02:00:00:e9:a6:c6”,  
ETH0\_MASK = “255.255.255.255”,  
ETH0\_METHOD = “static”,  
ETH0\_METRIC = “”,  
ETH0\_MTU = “”,  
ETH0\_NETWORK = “”,  
ETH0\_SEARCH\_DOMAIN = “”,  
ETH0\_VLAN\_ID = “”,  
ETH0\_VROUTER\_IP = “”,  
ETH0\_VROUTER\_IP6 = “”,  
ETH0\_VROUTER\_MANAGEMENT = “”,  
ETH1\_DNS = “8.8.8.8 8.8.4.4”,  
ETH1\_EXTERNAL = “”,  
ETH1\_GATEWAY = “10.10.114.1”,  
ETH1\_IP = “10.10.114.160”,  
ETH1\_IP6 = “”,  
ETH1\_IP6\_GATEWAY = “”,  
ETH1\_IP6\_METHOD = “”,  
ETH1\_IP6\_METRIC = “”,  
ETH1\_IP6\_PREFIX\_LENGTH = “”,  
ETH1\_IP6\_ULA = “”,  
ETH1\_MAC = “02:00:0a:0a:72:a0”,  
ETH1\_MASK = “255.255.0.0”,  
ETH1\_METHOD = “”,  
ETH1\_METRIC = “”,  
ETH1\_MTU = “”,  
ETH1\_NETWORK = “10.10.0.0”,  
ETH1\_SEARCH\_DOMAIN = “”,  
ETH1\_VLAN\_ID = “”,  
ETH1\_VROUTER\_IP = “”,  
ETH1\_VROUTER\_IP6 = “”,  
ETH1\_VROUTER\_MANAGEMENT = “”,  
NETWORK = “YES”,  
SSH\_PUBLIC\_KEY = “”,  
TARGET = “hda” ]  
CPU = “0.3”  
DISK = [  
ALLOW\_ORPHANS = “FORMAT”,  
CLONE = “YES”,  
CLONE\_TARGET = “SYSTEM”,  
CLUSTER\_ID = “100”,  
DATASTORE = “Default-D02”,  
DATASTORE\_ID = “101”,  
DEV\_PREFIX = “vd”,  
DISK\_ID = “0”,  
DISK\_SNAPSHOT\_TOTAL\_SIZE = “0”,  
DISK\_TYPE = “FILE”,  
DRIVER = “qcow2”,  
FORMAT = “qcow2”,  
IMAGE = “Debian 12 D02 Image”,  
IMAGE\_ID = “24”,  
IMAGE\_STATE = “2”,  
LN\_TARGET = “SYSTEM”,  
ORIGINAL\_SIZE = “20480”,  
READONLY = “NO”,  
SAVE = “NO”,  
SIZE = “20480”,  
SOURCE = “/var/lib/one//datastores/101/c8c3121cc1996024293cb50ee39a4cd1”,  
TARGET = “vda”,  
TM\_MAD = “shared”,  
TM\_MAD\_SYSTEM = “ssh”,  
TYPE = “FILE” ]  
GRAPHICS = [  
LISTEN = “0.0.0.0”,  
PORT = “5949”,  
TYPE = “VNC” ]  
MEMORY = “2048”  
MEMORY\_MAX = “16384”  
MEMORY\_RESIZE\_MODE = “BALLOONING”  
NIC = [  
AR\_ID = “0”,  
BRIDGE = “br0”,  
BRIDGE\_TYPE = “linux”,  
CLUSTER\_ID = “100”,  
GATEWAY = “”,  
IP = “”,  
MAC = “02:00:00:e9:a6:c6”,  
METHOD = “static”,  
NAME = “NIC0”,  
NETWORK = “Ponte externa D02”,  
NETWORK\_ID = “32”,  
NIC\_ID = “0”,  
SECURITY\_GROUPS = “0”,  
TARGET = “one-49-0”,  
VN\_MAD = “bridge” ]  
NIC = [  
AR\_ID = “1”,  
BRIDGE = “br1”,  
BRIDGE\_TYPE = “linux”,  
CLUSTER\_ID = “100”,  
GATEWAY = “10.10.114.1”,  
IP = “10.10.114.160”,  
MAC = “02:00:0a:0a:72:a0”,  
NAME = “NIC1”,  
NETWORK = “Ponte interna D02”,  
NETWORK\_ID = “31”,  
NETWORK\_UNAME = “leandro”,  
NIC\_ID = “1”,  
SECURITY\_GROUPS = “0”,  
TARGET = “one-49-1”,  
VN\_MAD = “bridge” ]  
OS = [  
UUID = “3f811896-1e3b-4094-87f6-6532415e29da” ]  
SECURITY\_GROUP\_RULE = [  
PROTOCOL = “ALL”,  
RULE\_TYPE = “OUTBOUND”,  
SECURITY\_GROUP\_ID = “0”,  
SECURITY\_GROUP\_NAME = “default” ]  
SECURITY\_GROUP\_RULE = [  
PROTOCOL = “ALL”,  
RULE\_TYPE = “INBOUND”,  
SECURITY\_GROUP\_ID = “0”,  
SECURITY\_GROUP\_NAME = “default” ]  
TEMPLATE\_ID = “23”  
TM\_MAD\_SYSTEM = “ssh”  
VCPU = “1”  
VCPU\_MAX = “16”  
VMID = “49”

---

<div class="post-metadata">

**Author:** ![dclavijo](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/dclavijo/32/5265_2.png) [@dclavijo](https://forum.opennebula.io/u/dclavijo)\
**Post date:** [April 16, 2024, 10:00am UTC](https://forum.opennebula.io/t/debian-12-from-marketplace-netplan-does-not-apply-context-with-netplan/12008/7 "2024-04-16T10:00:40Z")

</div>

Try issuing different [metric values](https://docs.opennebula.io/6.8/management_and_operations/references/template.html?highlight=ethx_metric#context-section) for each of the interfaces configuration. For example set ETH0\_METRIC to 100 and ETH1\_METRIC to 200. In the yaml you sent, both are 0, which could be the cause of the conflict.

Alternatively, use only 1 default gw and [static routes](https://docs.opennebula.io/6.8/management_and_operations/references/template.html?highlight=ethx_routes#context-section).
