Quantcast
Channel: Ubuntu Forums - Networking & Wireless
Viewing all articles
Browse latest Browse all 23300

[server] Setting up netplan for vlan

$
0
0
Hi there,

I want to setup my ubuntu server for vlan usage.

So my netplan looks like this:

Code:

network:
    version: 2
    ethernets:
        enp1s0:
            dhcp4: yes
    vlans:
        enp1s0.20:
            id: 20
            link: enp1s0
        enp1s0.20:
            id: 20
            link:enp1s0

Now I want to configure the routing and read about routes and routing-policy.
My first try to add rt_tables for each interface and changing the netplan as follow:

Code:

network:
    version: 2
    ethernets:
        enp1s0:
            dhcp4: no
            addresses: [172.16.1.10/24]
            routes:
              - to: 0.0.0.0/0
                via: 172.16.1.1
                table: 201
            routing-policy:
              - from: 172.16.1.0/24
                table: 201
    vlans:
        enp1s0.20:
            id: 20
            link: enp1s0

            routes:
              - to: 0.0.0.0/0
                via: 172.16.20.1
                table: 202
            routing-policy:
              - from: 172.16.20.0/24
                table: 202
       
        enp1s0.30:
         
            id
: 30           
            link
:enp1s0           
            routes:
                - to: 0.0.0.0/0
                  via: 172.16.30.1
                  table: 203
            routing-policy:
                - from: 172.16.30.0/24
                  table: 203

I don't need ip addresses in the vlan, because I run a docker with macvlan internally.

But now I can't access my ubuntu server anymore. SSH isn't working.

What I am doing wrong here?

Viewing all articles
Browse latest Browse all 23300

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>