0

I have properly configured the network on my host server and my virtual server (VPS(KVM)) able to communicate and reachable by one of three interfaces. Each of them works well, but I don't know where I wrong because three interfaces don't work simultaneously.

There is my config

Internal network

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: yes

External interfaces

network:
  version: 2
  ethernets:
    enp2s0:
      dhcp4: no
      dhcp6: no
      addresses:
        - 51.38.110.9/32
      gateway4: 145.239.244.1
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
        search: []
      optional: true
      routes:
        - to: 145.239.244.1/32
          via: 51.38.110.9
          scope: link
network:
  version: 2
  ethernets:
    enp3s0:
      dhcp4: no
      dhcp6: no
      addresses:
        - 51.38.110.8/32
      gateway4: 145.239.244.1
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
        search: []
      optional: true
      routes:
        - to: 145.239.244.1/32
          via: 51.38.110.8
          scope: link
network:
  version: 2
  ethernets:
    enp4s0:
      dhcp4: no
      dhcp6: no
      addresses:
        - 51.38.110.7/32
      gateway4: 145.239.244.1
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
        search: []
      optional: true
      routes:
        - to: 145.239.244.1/32
          via: 51.38.110.7
          scope: link

Thank in advance

  • How many .yaml files do you have in /etc/netplan? It looks like you've defined enp2s0 three times. Also, you can't specify gateway4 when you specify routes. – heynnema Dec 17 '19 at 20:05
  • heynnema, I am sorry, I have enp1s0 - enp5s0 – Rostyslav Malenko Dec 18 '19 at 8:39
0

precursor to a final .yaml file...

replace all of your .yaml files with this...

I have two examples for you...

Example #1

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: yes
    enp2s0:
      addresses: [51.38.110.9/32]
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      routes:
        - to: 145.239.244.1/32 # this might be wrong
          via: 51.38.110.9 # this might be wrong
          scope: link
      optional: true
    enp3s0:
      addresses: [51.38.110.8/32]
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      routes:
        - to: 145.239.244.1/32 # this might be wrong
          via: 51.38.110.8 # this might be wrong
          scope: link
      optional: true
    enp4s0:
      addresses: [51.38.110.7/32]
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      routes:
        - to: 145.239.244.1/32 # this might be wrong
          via: 51.38.110.7 # this might be wrong
          scope: link
      optional: true
    enp5s0:
      dhcp4: no
      dhcp6: no

Example #2

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      dhcp4: yes
    enp2s0:
      addresses: [51.38.110.9/32]
      gateway4: 145.239.244.1 # don't use together with routes:
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      optional: true
    enp3s0:
      addresses: [51.38.110.8/32]
      gateway4: 145.239.244.1 # don't use together with routes:
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      optional: true
    enp4s0:
      addresses: [51.38.110.7/32]
      gateway4: 145.239.244.1 # don't use together with routes:
      nameservers:
        addresses:
          - 213.186.33.99
          - 8.8.8.8
          - 8.8.4.4
      optional: true
    enp5s0:
      dhcp4: no
      dhcp6: no

sudo netplan --debug generate # generate config files

sudo netplan apply # apply configuration

reboot # reboot the computer

  • heynnema, thank you. Your config should work. But, I'm sorry, I posted incorrect config. I have 5 interfaces enp1s0 - enp5s0 and each of them in own yaml file. – Rostyslav Malenko Dec 18 '19 at 8:42
  • @RostyslavMalenko Is it one PCI card with 4-5 ports, or 4-5 PCI cards with one port each? You have the same MAC address in all three .yaml files... can't be right... correct? You also have gateway4: and routes: together, and you can't do that. Let me know and I'll put together a different .yaml. – heynnema Dec 18 '19 at 15:45
  • I have removed MAC. In my real config MACs are different. It is VPS with 5 virtual NIC which each of them has own MAC. – Rostyslav Malenko Dec 18 '19 at 15:54
  • @RostyslavMalenko Let me work on a new .yaml for you... – heynnema Dec 18 '19 at 16:05
  • @RostyslavMalenko it may not be perfect, but it's a good start. Check the routes addresses. – heynnema Dec 18 '19 at 16:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.