1

Disclaimer: To this day I've been a lurker, still learning and for the the first time in 2 years, I didn't find any answer to my question, thank you very much for your read and I hope you'll take some time to help

I'm trying to setup two VLANS on my already existing LAN card, the purpose of this setup is to first make a first VLAN work before having everything going through different VLANS for different purposes

Here is my configuration:

Lan card:

cat /etc/netplan/10-enp1s0.yaml network:  version: 2  renderer: networkd  ethernets:
#LAN CARD config
   enp1s0:
     optional: true
     dhcp4: false
     dhcp6: false
     addresses: [192.168.1.91/24, ]
     gateway4: 192.168.1.254
     nameservers:
       addresses: [192.168.1.91, ] //I have a DNS on the server
       search: [domain.net]

Vlan:

cat /etc/netplan/11-vlan.11.yaml
 vlans:
   vlan.11:
     id: 11
     link: enp1s0
     optional: true
     dhcp4: false
     dhcp6: false
     addresses: [192.168.1.92/24, ]
     nameservers:
       addresses: [192.168.1.91, ]

With this configuration, here are the results:

  • When I try to ping vlan.11 from enp1s0, or the other way around I have no reply.
  • When I try to ping any internet from enp1s0, it works, but when I try with vlan.11, it doesn't work.

8.8.8.8 with enp1s0:

ping -I enp1s0 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.1.91 enp1s0: 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=57 time=9.24 ms

8.8.8.8 with vlan.11:

ping -I vlan.11 8.8.8.8
PING 8.8.8.8 (8.8.8.8) from 192.168.1.92 vlan.11: 56(84) bytes of data.
3 packets transmitted, 0 received, 100% packet loss, time 2039ms
  • The last part and the weirdest one is that I'm able to ping both adresses with my a different PC on the same network
Pinging 192.168.1.91 with 32 bytes of data: Reply from 192.168.1.91:
bytes=32 time<1ms TTL=64

Pinging 192.168.1.92 with 32 bytes of data: Reply from 192.168.1.92:
bytes=32 time<1ms TTL=64 Reply from 192.168.1.92: bytes=32 time<1ms
TTL=64

So, can you please explain me why my vlan is not working properly ? What am I missing to have vlan.11 to behave like a network card.

Thank you very much for your read and any help is greatly appreciated.

When I type sudo netplan --debug generate, I see this (don't worry about enp2s0, not configured neither connected for now):

sudo netplan --debug generate
DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:9423): DEBUG: 11:30:08.752: Processing input file /etc/netplan/10-enp1s0.yaml..
** (generate:9423): DEBUG: 11:30:08.752: starting new processing pass
** (generate:9423): DEBUG: 11:30:08.752: Processing input file /etc/netplan/11-vlan.11.yaml..
** (generate:9423): DEBUG: 11:30:08.752: starting new processing pass
** (generate:9423): DEBUG: 11:30:08.752: Processing input file /etc/netplan/20-enp2s0.yaml..
** (generate:9423): DEBUG: 11:30:08.752: starting new processing pass
** (generate:9423): DEBUG: 11:30:08.752: vlan.11: setting default backend to 1
** (generate:9423): DEBUG: 11:30:08.752: Configuration is valid
** (generate:9423): DEBUG: 11:30:08.752: enp2s0: setting default backend to 1
** (generate:9423): DEBUG: 11:30:08.752: Configuration is valid
** (generate:9423): DEBUG: 11:30:08.752: enp1s0: setting default backend to 1
** (generate:9423): DEBUG: 11:30:08.752: Configuration is valid
** (generate:9423): DEBUG: 11:30:08.752: Generating output files..
** (generate:9423): DEBUG: 11:30:08.752: NetworkManager: definition enp1s0 is not for us (backend 1)
** (generate:9423): DEBUG: 11:30:08.752: NetworkManager: definition vlan.11 is not for us (backend 1)
** (generate:9423): DEBUG: 11:30:08.752: NetworkManager: definition enp2s0 is not for us (backend 1)
Samy
  • 11
  • 1
  • 1
  • 5

3 Answers3

1

Your .yaml files are incomplete.

You can't "erasing my LAN card configuration".

Remove both .yaml files and try this... keep the same spacing and indentation, and no tabs...

network:
  version: 2
  renderer: networkd
  ethernets:
    enp1s0:
      addresses: [192.168.1.91/24]
      gateway4: 192.168.1.254
      nameservers:
        addresses: 192.168.1.91
        search: [domain.net]
      optional: true
  vlans:
    vlan.11:
      id: 11
      link: enp1s0
      addresses: [192.168.1.92/24]

sudo netplan --debug generate # generate config files

sudo netplan apply # apply new configuration

reboot # reboot the computer

heynnema
  • 73,649
0

@heynnema:

Here is the output of sudo netplan --debug generate, I've just added optional to vlan.11 so the server will not wait for cloud-init

sudo netplan --debug generate

DEBUG:command generate: running ['/lib/netplan/generate']
** (generate:4851): DEBUG: 23:05:16.984: Processing input file /etc/netplan/10-enp1s0.yaml..
** (generate:4851): DEBUG: 23:05:16.984: starting new processing pass
** (generate:4851): DEBUG: 23:05:16.984: vlan.11: setting default backend to 1
** (generate:4851): DEBUG: 23:05:16.984: Configuration is valid
** (generate:4851): DEBUG: 23:05:16.984: enp1s0: setting default backend to 1
** (generate:4851): DEBUG: 23:05:16.984: Configuration is valid
** (generate:4851): DEBUG: 23:05:16.984: Generating output files..
** (generate:4851): DEBUG: 23:05:16.984: NetworkManager: definition enp1s0 is not for us (backend 1)
** (generate:4851): DEBUG: 23:05:16.984: NetworkManager: definition vlan.11 is not for us (backend 1)

uname -r

4.19.0-041900-generic

dpkg -l netplan

dpkg -l *netplan*
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                                                  Version                         Architecture                    Description
+++-=====================================================-===============================-===============================-===============================================================================================================
un  netplan                                               <none>                          <none>                          (no description available)
ii  netplan.io                                            0.98-0ubuntu1~18.04.1           amd64                           YAML network configuration abstraction for various backends

I really hope this will help you to help me on this issue, thank you again for your time.

Samy
  • 11
  • 1
  • 1
  • 5
0

Problem solved !

Instead of pinging and using vlan.11 (which is ..layer 2 name ? kind of?)

Anyway, using the ip adress directly works like a charm, so in short:

ping -I vlan.11 doesn't work ping -I work perfectly !

Thank you for your help, hope this helps someone else

Samy
  • 11
  • 1
  • 1
  • 5