2

I would like to set up two interfaces in one config file of netplan.

Currently I am using this one:

  network:
  version: 2
  renderer: networkd
  ethernets:
          ens18:
                dhcp4: no
                dhcp6: no
                addresses: [1.2.3.4/32]
                gateway4: 1.2.3.254
                nameservers:
                        search: [domain.tld]
                        addresses: [123.456.789.101]
                routes:
                - to: 1.2.3.254/32
                  via: 0.0.0.0
                  scope: link
          ens19:
                dhcp4: true

Without the second interface (ens19) it is working fine. After adding the second interface (ens19) the system has some troubles while booting up. But after the system comes up, the second interface is working fine.

What I am doing wrong?

Thanks in advance.

New output:

root@web:/etc/netplan# sudo netplan --debug apply
** (generate:18692): DEBUG: 03:51:19.153: Processing input file /etc/netplan/50-cloud-init.yaml..
** (generate:18692): DEBUG: 03:51:19.153: starting new processing pass
** (generate:18692): DEBUG: 03:51:19.153: ens18: setting default backend to 1
** (generate:18692): DEBUG: 03:51:19.153: ens19: setting default backend to 1
** (generate:18692): DEBUG: 03:51:19.153: Generating output files..
** (generate:18692): DEBUG: 03:51:19.153: NetworkManager: definition ens18 is not for us (backend 1)
** (generate:18692): DEBUG: 03:51:19.153: NetworkManager: definition ens19 is not for us (backend 1)
DEBUG:netplan generated networkd configuration exists, restarting networkd
DEBUG:no netplan generated NM configuration exists
DEBUG:ens18 not found in {}
DEBUG:ens19 not found in {'ens18': {'addresses': ['1.2.3.4/32'], 'gateway4': '1.2.3.254', 'dhcp4': False, 'dhcp6': False, 'nameservers': {'search': ['domain.tld'], 'addresses': ['1.2.3.4']}, 'routes': [{'to': '1.2.3.254/32', 'via': '0.0.0.0', 'scope': 'link'}]}}
DEBUG:Merged config:
network:
  bonds: {}
  bridges: {}
  ethernets:
    ens18:
      addresses:
      - 1.2.3.4/32
      dhcp4: false
      dhcp6: false
      gateway4: 1.2.3.254
      nameservers:
        addresses:
        - 1.2.3.4
        search:
        - domain.tld
      routes:
      - scope: link
        to: 1.2.3.254/32
        via: 0.0.0.0
    ens19:
      dhcp4: true
      dhcp6: false
  vlans: {}
  wifis: {}

DEBUG:Skipping non-physical interface: lo
DEBUG:device ens18 operstate is up, not changing
DEBUG:device ens19 operstate is up, not changing
DEBUG:{}
DEBUG:netplan triggering .link rules for lo
DEBUG:netplan triggering .link rules for ens18
DEBUG:netplan triggering .link rules for ens19

Same problem after rebooting

root@web:~# ip addr show dev ens19
3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 12:87:10:bf:35:c5 brd ff:ff:ff:ff:ff:ff
    inet 10.0.0.3/8 brd 10.255.255.255 scope global dynamic ens19
       valid_lft 602786sec preferred_lft 602786sec
    inet6 fe80::1087:10ff:febf:35c5/64 scope link
       valid_lft forever preferred_lft forever


root@web:~# ip route show dev ens19
10.0.0.0/8 proto kernel scope link src 10.0.0.3
6
  • Oh sorry for the broken code syntax. Btw the second network interface is just for intranet purposes.
    – coolbuntu
    Feb 27, 2019 at 8:39
  • Can you please post the output of ip link show? Thanks
    – Alpy
    Feb 27, 2019 at 8:48
  • root@web:/etc/php# ip link show 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 2: ens18: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 02:00:00:f1:63:5e brd ff:ff:ff:ff:ff:ff 3: ens19: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP mode DEFAULT group default qlen 1000 link/ether 12:87:10:bf:35:c5 brd ff:ff:ff:ff:ff:ff
    – coolbuntu
    Feb 27, 2019 at 8:52
  • what do 'ip addr show dev ens19' and 'ip route show dev ens19' show after boot?
    – slangasek
    Feb 27, 2019 at 21:00
  • Added answer to my question.
    – coolbuntu
    Feb 28, 2019 at 3:26

3 Answers 3

3

Please add this configuration:

network:
    renderer: networkd
    ethernets:
        ens18:
            addresses: [1.2.3.4/24]
            gateway4: 1.2.3.254
            dhcp4: no
            dhcp6: no
            nameservers:
                    search: [domain.tld]
                    addresses: [123.456.789.101]
            routes:
            - to: 1.2.3.254/32
              via: 0.0.0.0
              scope: link
        ens19:
            dhcp4: true
            dhcp6: no
    version: 2

and no need to reboot just

sudo netplan --debug apply

Please paste the output of this

3
  • Posted as answer
    – coolbuntu
    Feb 27, 2019 at 9:29
  • I have added renderer: networkd please edit and try again. You can add the out in you initial questiion no need to port a answer..
    – Alpy
    Feb 27, 2019 at 9:39
  • Thanks! I tried it again and after a reboot the problem is still the same. New output edited in my question.
    – coolbuntu
    Feb 28, 2019 at 2:55
0

Are you sure you need approximately 17 million hosts in your DHCP?

10.0.0.0/8 is a large (very large network) maybe that's what is slowing it down.. You could however do this:

ens19:
        dhcp4: true
        dhcp6: true
        optional: true

This should remedy slow start alternatively change (if you can) your network size.

-1

I was having the same issue until I created the file 99-disable-network-config.cfg in the /etc/cloud/cloud.cfg.d/ directory. The contents of that file is below.

network: {config: disabled}

That command disables the cloud-init's network configuration capabilities, as per the comment section in the 50-cloud-init.yaml file located in the /etc/netplan/ directory.

My configuration now survives multiple reboots.

0

You must log in to answer this question.

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