Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


VirtFusion Bridge Networking
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

VirtFusion Bridge Networking

NessaCatNessaCat Member

I'm trying to set up standard bridge networking on a hypervisor using Netplan, but I'm not sure what I'm doing wrong. I was following the VirtFusion hypervisor installation docs. Then I got some errors and started reading the Netplan docs, and made my own config. I may be confused, help me understand. 🙏

My config.

network:
  version: 2
  renderer: networkd
  ethernets:
       eno1:
      dhcp4: false
  bridges:
    br0:
      interfaces:
      - eno1
      addresses:               # assigned IPv4s
      - 200.99.101.111/24
      - 200.99.102.111/24
      - 200.99.102.222/24
      - 200.99.103.111/24
      - 200.99.103.222/24
      - 200.99.103.333/24
      routes:
      - to: default
        via: 200.99.101.1     # gateway for primary IP 200.99.101.111
        table: 1
      - to: default
        via: 200.99.102.1     # gateway for 200.99.102.xxx
        table: 2
      - to: default
        via: 200.99.103.1     # gateway for 200.99.103.xxx
        table: 3
      routing-policy:
      - from: 200.99.101.111/24
        table: 1
      - from: 200.99.102.111/24
        table: 2
      - from: 200.99.102.222/24
        table: 2
      - from: 200.99.103.111/24
        table: 3
      - from: 200.99.103.222/24
        table: 3
      - from: 200.99.103.333/24
        table: 3
     dhcp4: no
      nameservers:
        addresses:
        - 1.1.1.1
        - 1.0.0.1
      parameters:
        stp: true
        forward-delay: 0

Comments

  • emghemgh Member

    The solution is to not use Netplan

  • kaitkait Member

    Debian cloudinit thingy also has it :(

  • emghemgh Member

    @kait said:

    Debian cloudinit thingy also has it :(

    Yeah, I wrote a short text with commands that I just copy paste to deploy a Debian hypervisor, I made it using ChatGPT by pasting the output of ’history’ and asking it to make the markdown guide. I can post it here for OP, let me just get to my computer🤓

  • emghemgh Member

    @NessaCat (for Debian)

    This guide outlines the steps for setting up and configuring your network on a Linux server. It includes commands to run, files to edit, and examples of file contents.

    Commands to Run

    First, execute the following commands in your terminal:

    apt-get update
    apt install ifupdown2 bridge-utils curl -y
    apt-get purge cloud-init
    apt-get purge netplan.io
    rm -rf /etc/cloud/
    rm -rf /var/lib/cloud/
    sudo apt autoremove
    

    Files to Edit

    You will need to edit the following files:

    1. /etc/network/interfaces
    2. /etc/resolv.conf
    3. /etc/systemd/resolved.conf

    /etc/network/interfaces

    This file configures your network interfaces. Here's the complete content for the file:

    # The loopback network interface
    auto lo
    iface lo inet loopback
    
    # Raw Network Port
    auto [change this]
    iface [change this]
    
    # Uplink
    auto br0
    iface br0
        address [change this]
        gateway [change this]
        dns-nameservers 1.1.1.1 1.0.0.1
        hwaddress [change this]
        bridge-ports [change this]
        bridge-stp off
        bridge-waitport 0
        bridge-fd 0
    

    /etc/resolv.conf

    This file sets up DNS servers for your network. Here's the complete content for the file:

    # This is /run/systemd/resolve/resolv.conf managed by man:systemd-resolved(8).
    # Do not edit.
    #
    # This file might be symlinked as /etc/resolv.conf. If you're looking at
    # /etc/resolv.conf and seeing this text, you have followed the symlink.
    #
    # This is a dynamic resolv.conf file for connecting local clients directly to
    # all known uplink DNS servers. This file lists all configured search domains.
    #
    # Third party programs should typically not access this file directly, but only
    # through the symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a
    # different way, replace this symlink by a static file or a different symlink.
    #
    # See man:systemd-resolved.service(8) for details about the supported modes of
    # operation for /etc/resolv.conf.
    
    nameserver 1.1.1.1
    nameserver 1.0.0.1
    search .
    

    /etc/systemd/resolved.conf

    This file is for systemd's network name resolution service. Here's the complete content for the file:

    #  This file is part of systemd.
    #
    #  systemd is free software; you can redistribute it and/or modify it under the
    #  terms of the GNU Lesser General Public License as published by the Free
    #  Software Foundation; either version 2.1 of the License, or (at your option)
    #  any later version.
    #
    # Entries in this file show the compile time defaults. Local configuration
    # should be created by either modifying this file, or by creating "drop-ins" in
    # the resolved.conf.d/ subdirectory. The latter is generally recommended.
    # Defaults can be restored by simply deleting this file and all drop-ins.
    #
    # Use 'systemd-analyze cat-config systemd/resolved.conf' to display the full config.
    #
    # See resolved.conf(5) for details.
    
    [Resolve]
    # Some examples of DNS servers which may be used for DNS= and FallbackDNS=:
    # Cloudflare: 1.1.1.1#cloudflare-dns.com 1.0.0.1#cloudflare-dns.com 2606:4700:4700::1111#cloudflare-dns.com 2606:4700:4700::1001#cloudflare-dns.com
    # Google:     8.8.8.8#dns.google 8.8.4.4#dns.google 2001:4860:4860::8888#dns.google 2001:4860:4860::8844#dns.google
    # Quad9:      9.9.9.9#dns.quad9.net 149.112.112.112#dns.quad9.net 2620:fe::fe#dns.quad9.net 2620:fe::9#dns.quad9.net
    DNS=1.1.1.1 1.0.0.1
    #FallbackDNS=
    #Domains=
    #DNSSEC=no
    #DNSOverTLS=no
    #MulticastDNS=yes
    #LLMNR=yes
    #Cache=yes
    #CacheFromLocalhost=no
    #DNSStubListener=yes
    #DNSStubListenerExtra=
    #ReadEtcHosts=yes
    

    Restart Services

    After editing the files, restart the network services with these commands:

    systemctl restart networking
    systemctl restart systemd-networkd
    systemctl restart systemd-resolved
    
    Thanked by 30xC7 sh97 NessaCat
  • emghemgh Member
    edited March 8

    Obviously it can be easily improved such as merging the apt commands and deciding on sudo vs non-sudo etc but it's 100 % GPT based on my 'history' output and I cba to fix it up as it's only meant for me..

  • kaitkait Member

    Ty @emgh I hate netplan, it has been the worse mistake of debain/ubuntu

  • emghemgh Member

    @kait said:
    Ty @emgh I hate netplan, it has been the worse mistake of debain/ubuntu

    Yup, definitely annoying. I think it was @FatGrizzly telling me to just not when I tried to make it work properly, and I've followed the advice since :D

    Thanked by 2kait FatGrizzly
  • emghemgh Member
    edited March 8

    @totally_not_banned or anyone else that might know, in my guide, I as said just used GPT to look at what I've done and make it readable for myself to follow in the future, but, is the editing of /etc/resolv.conf totally meaningless? As said, I just winged it, and it worked, but as I read it I realize that the system should get its DNS settings from /etc/systemd/resolved.conf anyway, right?

    Edit: Yes, I read it for another few seconds and realized it's just a symlink of /run/systemd/resolve/resolv.conf.

  • edited March 8

    @emgh said:
    @totally_not_banned or anyone else that might know, in my guide, I as said just used GPT to look at what I've done and make it readable for myself to follow in the future, but, is the editing of /etc/resolv.conf totally meaningless? As said, I just winged it, and it worked, but as I read it I realize that the system should get its DNS settings from /etc/systemd/resolved.conf anyway, right?

    Edit: Yes, I read it for another few seconds and realized it's just a symlink of /run/systemd/resolve/resolv.conf.

    Well, from what i understand it's usually meaningless as in it'll work for everything which doesn't try to read /etc/resolv.conf directly (according Arch's wiki - yeah i had to look this up too - stuff like web browsers, software compiled from Go, GnuPG, ...). For those types of software systemd usually (as the default of 3 optional modes...) puts a single local DNS resolver running on 127.0.0.53 there. Talk about making stuff complicated. I figure putting some external DNS server there wouldn't really hurt either though as the only side effect would be avoiding systemd's resolver, i guess.

    Thanked by 1emgh
  • emghemgh Member
    edited March 8

    @totally_not_banned said: For those types of software systemd usually (as the default of 3 optional modes...) puts a single local DNS resolver running on 127.0.0.53 there. Talk about making stuff complicated. I figure putting some external DNS server there wouldn't really hurt either though as the only side effect would be avoiding systemd's resolver, i guess.

    That's interesting, I remember seeing that on one of my systems!

    Anyway, with the config that I posted above, /etc/resolv.conf simply symlinks to /run/systemd/resolve/resolv.conf, and sudo systemctl restart systemd-resolved resets the whole file according to systemd configurations, /etc/resolv.conf looking like (afterwards, minus the comments):

    nameserver 1.1.1.1
    nameserver 1.0.0.1
    search .

    So editing it manually is not needed. It'll reset on restart anyway.

    Thanked by 1totally_not_banned
Sign In or Register to comment.