Lost network connectivity on Hetzner with Netplan bridge












0















I installed the Ubuntu 18.04 and wanted to have a bridge interface instead of using the main interface directly for KVM virtualization:



Here is the Netplan default configuration after installation, which worked well:



----
# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
enp4s0:
addresses: [ 176.9.199.230/27 ]
gateway4: 176.9.199.225
nameservers:
addresses:
- "8.8.8.8"


After reading the documentation for Netplan, I tried this setting for bridge mode:



---

network:
version: 2
renderer: networkd
ethernets:
enp4s0:
dhcp4: no
dhcp6: no
bridges:
vmbr0:
dhcp4: no
dhcp6: no
interfaces: [ enp4s0 ]
addresses: [ 176.9.199.230/27 ]
gateway4: 176.9.199.225
nameservers:
addresses:
- "127.0.0.1"
parameters:
stp: false
forward-delay: 1
hello-time: 2
max-age: 12


As you can tell from the IP address, the server is hosted on Hetzner.



On Ubuntu 16.04, bridges worked well with ifupdown, but now that Ubuntu 18.04 has Netplan instead of ifupdown, I need to know how configure a bridge in Netplan.










share|improve this question





























    0















    I installed the Ubuntu 18.04 and wanted to have a bridge interface instead of using the main interface directly for KVM virtualization:



    Here is the Netplan default configuration after installation, which worked well:



    ----
    # This file describes the network interfaces available on your system
    # For more information, see netplan(5).
    network:
    version: 2
    renderer: networkd
    ethernets:
    enp4s0:
    addresses: [ 176.9.199.230/27 ]
    gateway4: 176.9.199.225
    nameservers:
    addresses:
    - "8.8.8.8"


    After reading the documentation for Netplan, I tried this setting for bridge mode:



    ---

    network:
    version: 2
    renderer: networkd
    ethernets:
    enp4s0:
    dhcp4: no
    dhcp6: no
    bridges:
    vmbr0:
    dhcp4: no
    dhcp6: no
    interfaces: [ enp4s0 ]
    addresses: [ 176.9.199.230/27 ]
    gateway4: 176.9.199.225
    nameservers:
    addresses:
    - "127.0.0.1"
    parameters:
    stp: false
    forward-delay: 1
    hello-time: 2
    max-age: 12


    As you can tell from the IP address, the server is hosted on Hetzner.



    On Ubuntu 16.04, bridges worked well with ifupdown, but now that Ubuntu 18.04 has Netplan instead of ifupdown, I need to know how configure a bridge in Netplan.










    share|improve this question



























      0












      0








      0








      I installed the Ubuntu 18.04 and wanted to have a bridge interface instead of using the main interface directly for KVM virtualization:



      Here is the Netplan default configuration after installation, which worked well:



      ----
      # This file describes the network interfaces available on your system
      # For more information, see netplan(5).
      network:
      version: 2
      renderer: networkd
      ethernets:
      enp4s0:
      addresses: [ 176.9.199.230/27 ]
      gateway4: 176.9.199.225
      nameservers:
      addresses:
      - "8.8.8.8"


      After reading the documentation for Netplan, I tried this setting for bridge mode:



      ---

      network:
      version: 2
      renderer: networkd
      ethernets:
      enp4s0:
      dhcp4: no
      dhcp6: no
      bridges:
      vmbr0:
      dhcp4: no
      dhcp6: no
      interfaces: [ enp4s0 ]
      addresses: [ 176.9.199.230/27 ]
      gateway4: 176.9.199.225
      nameservers:
      addresses:
      - "127.0.0.1"
      parameters:
      stp: false
      forward-delay: 1
      hello-time: 2
      max-age: 12


      As you can tell from the IP address, the server is hosted on Hetzner.



      On Ubuntu 16.04, bridges worked well with ifupdown, but now that Ubuntu 18.04 has Netplan instead of ifupdown, I need to know how configure a bridge in Netplan.










      share|improve this question
















      I installed the Ubuntu 18.04 and wanted to have a bridge interface instead of using the main interface directly for KVM virtualization:



      Here is the Netplan default configuration after installation, which worked well:



      ----
      # This file describes the network interfaces available on your system
      # For more information, see netplan(5).
      network:
      version: 2
      renderer: networkd
      ethernets:
      enp4s0:
      addresses: [ 176.9.199.230/27 ]
      gateway4: 176.9.199.225
      nameservers:
      addresses:
      - "8.8.8.8"


      After reading the documentation for Netplan, I tried this setting for bridge mode:



      ---

      network:
      version: 2
      renderer: networkd
      ethernets:
      enp4s0:
      dhcp4: no
      dhcp6: no
      bridges:
      vmbr0:
      dhcp4: no
      dhcp6: no
      interfaces: [ enp4s0 ]
      addresses: [ 176.9.199.230/27 ]
      gateway4: 176.9.199.225
      nameservers:
      addresses:
      - "127.0.0.1"
      parameters:
      stp: false
      forward-delay: 1
      hello-time: 2
      max-age: 12


      As you can tell from the IP address, the server is hosted on Hetzner.



      On Ubuntu 16.04, bridges worked well with ifupdown, but now that Ubuntu 18.04 has Netplan instead of ifupdown, I need to know how configure a bridge in Netplan.







      networking ubuntu bridge netplan






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jan 1 at 13:02









      Deltik

      13.1k144887




      13.1k144887










      asked Dec 31 '18 at 16:14









      swebsweb

      3111410




      3111410






















          1 Answer
          1






          active

          oldest

          votes


















          1














          The MAC address is randomized if you do not explicitly set it in your bridge configuration in Netplan.



          If I recall correctly, Hetzner restricts the IP address you are allocated to your server's MAC address, so you may need to set the bridge's MAC address to the physical interface's.



          To get the physical interface's MAC address, run this command:



          cat /sys/class/net/enp4s0/address


          (Replace enp4s0 with the appropriate interface name, if needed.)



          In your Netplan configuration file, add the MAC address under the bridge interface name like so:



          macaddress: xx:xx:xx:xx:xx:xx


          For you, your Netplan configuration should look like this:



          ---
          network:
          version: 2
          renderer: networkd
          ethernets:
          enp4s0:
          dhcp4: no
          dhcp6: no
          bridges:
          vmbr0:
          macaddress: xx:xx:xx:xx:xx:xx
          dhcp4: no
          dhcp6: no
          interfaces: [ enp4s0 ]
          addresses: [ 176.9.199.230/27 ]
          gateway4: 176.9.199.225
          nameservers:
          addresses:
          - "127.0.0.1"
          parameters:
          stp: false
          forward-delay: 1
          hello-time: 2
          max-age: 12


          Apply the configuration:



          sudo brctl delbr enp4s0
          sudo netplan apply


          Now you should have a bridge with functioning host connectivity.






          share|improve this answer
























          • thank you for answer i will try it and mark as correct if worked.

            – sweb
            Dec 31 '18 at 18:58











          • work like a charm

            – sweb
            Dec 31 '18 at 20:03






          • 1





            thank you for your sharing.

            – daidai
            Jan 1 at 8:43











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1389309%2flost-network-connectivity-on-hetzner-with-netplan-bridge%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1














          The MAC address is randomized if you do not explicitly set it in your bridge configuration in Netplan.



          If I recall correctly, Hetzner restricts the IP address you are allocated to your server's MAC address, so you may need to set the bridge's MAC address to the physical interface's.



          To get the physical interface's MAC address, run this command:



          cat /sys/class/net/enp4s0/address


          (Replace enp4s0 with the appropriate interface name, if needed.)



          In your Netplan configuration file, add the MAC address under the bridge interface name like so:



          macaddress: xx:xx:xx:xx:xx:xx


          For you, your Netplan configuration should look like this:



          ---
          network:
          version: 2
          renderer: networkd
          ethernets:
          enp4s0:
          dhcp4: no
          dhcp6: no
          bridges:
          vmbr0:
          macaddress: xx:xx:xx:xx:xx:xx
          dhcp4: no
          dhcp6: no
          interfaces: [ enp4s0 ]
          addresses: [ 176.9.199.230/27 ]
          gateway4: 176.9.199.225
          nameservers:
          addresses:
          - "127.0.0.1"
          parameters:
          stp: false
          forward-delay: 1
          hello-time: 2
          max-age: 12


          Apply the configuration:



          sudo brctl delbr enp4s0
          sudo netplan apply


          Now you should have a bridge with functioning host connectivity.






          share|improve this answer
























          • thank you for answer i will try it and mark as correct if worked.

            – sweb
            Dec 31 '18 at 18:58











          • work like a charm

            – sweb
            Dec 31 '18 at 20:03






          • 1





            thank you for your sharing.

            – daidai
            Jan 1 at 8:43
















          1














          The MAC address is randomized if you do not explicitly set it in your bridge configuration in Netplan.



          If I recall correctly, Hetzner restricts the IP address you are allocated to your server's MAC address, so you may need to set the bridge's MAC address to the physical interface's.



          To get the physical interface's MAC address, run this command:



          cat /sys/class/net/enp4s0/address


          (Replace enp4s0 with the appropriate interface name, if needed.)



          In your Netplan configuration file, add the MAC address under the bridge interface name like so:



          macaddress: xx:xx:xx:xx:xx:xx


          For you, your Netplan configuration should look like this:



          ---
          network:
          version: 2
          renderer: networkd
          ethernets:
          enp4s0:
          dhcp4: no
          dhcp6: no
          bridges:
          vmbr0:
          macaddress: xx:xx:xx:xx:xx:xx
          dhcp4: no
          dhcp6: no
          interfaces: [ enp4s0 ]
          addresses: [ 176.9.199.230/27 ]
          gateway4: 176.9.199.225
          nameservers:
          addresses:
          - "127.0.0.1"
          parameters:
          stp: false
          forward-delay: 1
          hello-time: 2
          max-age: 12


          Apply the configuration:



          sudo brctl delbr enp4s0
          sudo netplan apply


          Now you should have a bridge with functioning host connectivity.






          share|improve this answer
























          • thank you for answer i will try it and mark as correct if worked.

            – sweb
            Dec 31 '18 at 18:58











          • work like a charm

            – sweb
            Dec 31 '18 at 20:03






          • 1





            thank you for your sharing.

            – daidai
            Jan 1 at 8:43














          1












          1








          1







          The MAC address is randomized if you do not explicitly set it in your bridge configuration in Netplan.



          If I recall correctly, Hetzner restricts the IP address you are allocated to your server's MAC address, so you may need to set the bridge's MAC address to the physical interface's.



          To get the physical interface's MAC address, run this command:



          cat /sys/class/net/enp4s0/address


          (Replace enp4s0 with the appropriate interface name, if needed.)



          In your Netplan configuration file, add the MAC address under the bridge interface name like so:



          macaddress: xx:xx:xx:xx:xx:xx


          For you, your Netplan configuration should look like this:



          ---
          network:
          version: 2
          renderer: networkd
          ethernets:
          enp4s0:
          dhcp4: no
          dhcp6: no
          bridges:
          vmbr0:
          macaddress: xx:xx:xx:xx:xx:xx
          dhcp4: no
          dhcp6: no
          interfaces: [ enp4s0 ]
          addresses: [ 176.9.199.230/27 ]
          gateway4: 176.9.199.225
          nameservers:
          addresses:
          - "127.0.0.1"
          parameters:
          stp: false
          forward-delay: 1
          hello-time: 2
          max-age: 12


          Apply the configuration:



          sudo brctl delbr enp4s0
          sudo netplan apply


          Now you should have a bridge with functioning host connectivity.






          share|improve this answer













          The MAC address is randomized if you do not explicitly set it in your bridge configuration in Netplan.



          If I recall correctly, Hetzner restricts the IP address you are allocated to your server's MAC address, so you may need to set the bridge's MAC address to the physical interface's.



          To get the physical interface's MAC address, run this command:



          cat /sys/class/net/enp4s0/address


          (Replace enp4s0 with the appropriate interface name, if needed.)



          In your Netplan configuration file, add the MAC address under the bridge interface name like so:



          macaddress: xx:xx:xx:xx:xx:xx


          For you, your Netplan configuration should look like this:



          ---
          network:
          version: 2
          renderer: networkd
          ethernets:
          enp4s0:
          dhcp4: no
          dhcp6: no
          bridges:
          vmbr0:
          macaddress: xx:xx:xx:xx:xx:xx
          dhcp4: no
          dhcp6: no
          interfaces: [ enp4s0 ]
          addresses: [ 176.9.199.230/27 ]
          gateway4: 176.9.199.225
          nameservers:
          addresses:
          - "127.0.0.1"
          parameters:
          stp: false
          forward-delay: 1
          hello-time: 2
          max-age: 12


          Apply the configuration:



          sudo brctl delbr enp4s0
          sudo netplan apply


          Now you should have a bridge with functioning host connectivity.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Dec 31 '18 at 18:00









          DeltikDeltik

          13.1k144887




          13.1k144887













          • thank you for answer i will try it and mark as correct if worked.

            – sweb
            Dec 31 '18 at 18:58











          • work like a charm

            – sweb
            Dec 31 '18 at 20:03






          • 1





            thank you for your sharing.

            – daidai
            Jan 1 at 8:43



















          • thank you for answer i will try it and mark as correct if worked.

            – sweb
            Dec 31 '18 at 18:58











          • work like a charm

            – sweb
            Dec 31 '18 at 20:03






          • 1





            thank you for your sharing.

            – daidai
            Jan 1 at 8:43

















          thank you for answer i will try it and mark as correct if worked.

          – sweb
          Dec 31 '18 at 18:58





          thank you for answer i will try it and mark as correct if worked.

          – sweb
          Dec 31 '18 at 18:58













          work like a charm

          – sweb
          Dec 31 '18 at 20:03





          work like a charm

          – sweb
          Dec 31 '18 at 20:03




          1




          1





          thank you for your sharing.

          – daidai
          Jan 1 at 8:43





          thank you for your sharing.

          – daidai
          Jan 1 at 8:43


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1389309%2flost-network-connectivity-on-hetzner-with-netplan-bridge%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Список кардиналов, возведённых папой римским Каликстом III

          Deduzione

          Mysql.sock missing - “Can't connect to local MySQL server through socket”