Yet Another Netplan Question











up vote
0
down vote

favorite












having trouble getting my head around netplan.



I have 2 interfaces: ens18 & 19. ens18 is connected to my external network, ens19 connected internally.
I want all internet bound traffic to go out via ens18, however, it always goes out via ens19.



I set the DHCP metric on ens19 to 200, hoping that would resolve it, but no luck.



Here's my 50-cloud-init.yaml



network:
ethernets:
ens18:
addresses:
dhcp4: true
ens19:
addresses:
dhcp4: true
routes:
- to: 10.0.0.0/24
via: 10.100.0.254
metric: 100
table: 101
- to: 10.0.1.0/24
via: 10.100.0.254
metric: 100
table: 101
routing-policy:
- from: 10.0.0.0/24
table: 101
- from: 10.0.1.0/24
table: 101
version: 2


My 10-netplan-ens18.network



[Match]
Name=ens18

[Network]
DHCP=ipv4

[DHCP]
UseMTU=true
RouteMetric=100


And my 10-netplan-ens19.network



[Match]
Name=ens19

[Network]
DHCP=ipv4

[Route]
Destination=10.0.0.0/24
Gateway=10.100.0.254
Metric=100
Table=101

[Route]
Destination=10.0.1.0/24
Gateway=10.100.0.254
Metric=100
Table=101

[RoutingPolicyRule]
From=10.0.0.0/24
Table=101

[RoutingPolicyRule]
From=10.0.1.0/24
Table=101

[DHCP]
UseMTU=true
RouteMetric=200


You'll notice that I added some static routes on ens19. This is because, when I copied the intial ens19 config file to /etc/systemd/network (without the static routes) the internet-bound traffic did go out via ens18, but I wasn't able to connect to the ens19 interface from my internal network (my laptop is on a different subnet to the server)



My ip route output is



default via 10.100.0.254 dev ens19 proto dhcp src 10.100.0.13 metric 100
default via 10.1.2.254 dev ens18 proto dhcp src 10.1.2.3 metric 100
10.1.2.0/24 dev ens18 proto kernel scope link src 10.1.2.3
10.1.2.254 dev ens18 proto dhcp scope link src 10.1.2.3 metric 100
10.100.0.0/24 dev ens19 proto kernel scope link src 10.100.0.13
10.100.0.254 dev ens19 proto dhcp scope link src 10.100.0.13 metric 100


And ip rule is



0:      from all lookup local
0: from 10.0.0.0/24 lookup 101
0: from 10.0.1.0/24 lookup 101
32766: from all lookup main
32767: from all lookup default


TL;DR
I have an 18.04 server with 2 NICs, both assigned an address via DHCP (I'd rather keep it that way) but am unable to define both the default route to 0.0.0.0/0 and access the second interface from my internal network.



Hope someone can help here. I found it much easier to do this with 16.04 and previous.










share|improve this question







New contributor




user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    having trouble getting my head around netplan.



    I have 2 interfaces: ens18 & 19. ens18 is connected to my external network, ens19 connected internally.
    I want all internet bound traffic to go out via ens18, however, it always goes out via ens19.



    I set the DHCP metric on ens19 to 200, hoping that would resolve it, but no luck.



    Here's my 50-cloud-init.yaml



    network:
    ethernets:
    ens18:
    addresses:
    dhcp4: true
    ens19:
    addresses:
    dhcp4: true
    routes:
    - to: 10.0.0.0/24
    via: 10.100.0.254
    metric: 100
    table: 101
    - to: 10.0.1.0/24
    via: 10.100.0.254
    metric: 100
    table: 101
    routing-policy:
    - from: 10.0.0.0/24
    table: 101
    - from: 10.0.1.0/24
    table: 101
    version: 2


    My 10-netplan-ens18.network



    [Match]
    Name=ens18

    [Network]
    DHCP=ipv4

    [DHCP]
    UseMTU=true
    RouteMetric=100


    And my 10-netplan-ens19.network



    [Match]
    Name=ens19

    [Network]
    DHCP=ipv4

    [Route]
    Destination=10.0.0.0/24
    Gateway=10.100.0.254
    Metric=100
    Table=101

    [Route]
    Destination=10.0.1.0/24
    Gateway=10.100.0.254
    Metric=100
    Table=101

    [RoutingPolicyRule]
    From=10.0.0.0/24
    Table=101

    [RoutingPolicyRule]
    From=10.0.1.0/24
    Table=101

    [DHCP]
    UseMTU=true
    RouteMetric=200


    You'll notice that I added some static routes on ens19. This is because, when I copied the intial ens19 config file to /etc/systemd/network (without the static routes) the internet-bound traffic did go out via ens18, but I wasn't able to connect to the ens19 interface from my internal network (my laptop is on a different subnet to the server)



    My ip route output is



    default via 10.100.0.254 dev ens19 proto dhcp src 10.100.0.13 metric 100
    default via 10.1.2.254 dev ens18 proto dhcp src 10.1.2.3 metric 100
    10.1.2.0/24 dev ens18 proto kernel scope link src 10.1.2.3
    10.1.2.254 dev ens18 proto dhcp scope link src 10.1.2.3 metric 100
    10.100.0.0/24 dev ens19 proto kernel scope link src 10.100.0.13
    10.100.0.254 dev ens19 proto dhcp scope link src 10.100.0.13 metric 100


    And ip rule is



    0:      from all lookup local
    0: from 10.0.0.0/24 lookup 101
    0: from 10.0.1.0/24 lookup 101
    32766: from all lookup main
    32767: from all lookup default


    TL;DR
    I have an 18.04 server with 2 NICs, both assigned an address via DHCP (I'd rather keep it that way) but am unable to define both the default route to 0.0.0.0/0 and access the second interface from my internal network.



    Hope someone can help here. I found it much easier to do this with 16.04 and previous.










    share|improve this question







    New contributor




    user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      having trouble getting my head around netplan.



      I have 2 interfaces: ens18 & 19. ens18 is connected to my external network, ens19 connected internally.
      I want all internet bound traffic to go out via ens18, however, it always goes out via ens19.



      I set the DHCP metric on ens19 to 200, hoping that would resolve it, but no luck.



      Here's my 50-cloud-init.yaml



      network:
      ethernets:
      ens18:
      addresses:
      dhcp4: true
      ens19:
      addresses:
      dhcp4: true
      routes:
      - to: 10.0.0.0/24
      via: 10.100.0.254
      metric: 100
      table: 101
      - to: 10.0.1.0/24
      via: 10.100.0.254
      metric: 100
      table: 101
      routing-policy:
      - from: 10.0.0.0/24
      table: 101
      - from: 10.0.1.0/24
      table: 101
      version: 2


      My 10-netplan-ens18.network



      [Match]
      Name=ens18

      [Network]
      DHCP=ipv4

      [DHCP]
      UseMTU=true
      RouteMetric=100


      And my 10-netplan-ens19.network



      [Match]
      Name=ens19

      [Network]
      DHCP=ipv4

      [Route]
      Destination=10.0.0.0/24
      Gateway=10.100.0.254
      Metric=100
      Table=101

      [Route]
      Destination=10.0.1.0/24
      Gateway=10.100.0.254
      Metric=100
      Table=101

      [RoutingPolicyRule]
      From=10.0.0.0/24
      Table=101

      [RoutingPolicyRule]
      From=10.0.1.0/24
      Table=101

      [DHCP]
      UseMTU=true
      RouteMetric=200


      You'll notice that I added some static routes on ens19. This is because, when I copied the intial ens19 config file to /etc/systemd/network (without the static routes) the internet-bound traffic did go out via ens18, but I wasn't able to connect to the ens19 interface from my internal network (my laptop is on a different subnet to the server)



      My ip route output is



      default via 10.100.0.254 dev ens19 proto dhcp src 10.100.0.13 metric 100
      default via 10.1.2.254 dev ens18 proto dhcp src 10.1.2.3 metric 100
      10.1.2.0/24 dev ens18 proto kernel scope link src 10.1.2.3
      10.1.2.254 dev ens18 proto dhcp scope link src 10.1.2.3 metric 100
      10.100.0.0/24 dev ens19 proto kernel scope link src 10.100.0.13
      10.100.0.254 dev ens19 proto dhcp scope link src 10.100.0.13 metric 100


      And ip rule is



      0:      from all lookup local
      0: from 10.0.0.0/24 lookup 101
      0: from 10.0.1.0/24 lookup 101
      32766: from all lookup main
      32767: from all lookup default


      TL;DR
      I have an 18.04 server with 2 NICs, both assigned an address via DHCP (I'd rather keep it that way) but am unable to define both the default route to 0.0.0.0/0 and access the second interface from my internal network.



      Hope someone can help here. I found it much easier to do this with 16.04 and previous.










      share|improve this question







      New contributor




      user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      having trouble getting my head around netplan.



      I have 2 interfaces: ens18 & 19. ens18 is connected to my external network, ens19 connected internally.
      I want all internet bound traffic to go out via ens18, however, it always goes out via ens19.



      I set the DHCP metric on ens19 to 200, hoping that would resolve it, but no luck.



      Here's my 50-cloud-init.yaml



      network:
      ethernets:
      ens18:
      addresses:
      dhcp4: true
      ens19:
      addresses:
      dhcp4: true
      routes:
      - to: 10.0.0.0/24
      via: 10.100.0.254
      metric: 100
      table: 101
      - to: 10.0.1.0/24
      via: 10.100.0.254
      metric: 100
      table: 101
      routing-policy:
      - from: 10.0.0.0/24
      table: 101
      - from: 10.0.1.0/24
      table: 101
      version: 2


      My 10-netplan-ens18.network



      [Match]
      Name=ens18

      [Network]
      DHCP=ipv4

      [DHCP]
      UseMTU=true
      RouteMetric=100


      And my 10-netplan-ens19.network



      [Match]
      Name=ens19

      [Network]
      DHCP=ipv4

      [Route]
      Destination=10.0.0.0/24
      Gateway=10.100.0.254
      Metric=100
      Table=101

      [Route]
      Destination=10.0.1.0/24
      Gateway=10.100.0.254
      Metric=100
      Table=101

      [RoutingPolicyRule]
      From=10.0.0.0/24
      Table=101

      [RoutingPolicyRule]
      From=10.0.1.0/24
      Table=101

      [DHCP]
      UseMTU=true
      RouteMetric=200


      You'll notice that I added some static routes on ens19. This is because, when I copied the intial ens19 config file to /etc/systemd/network (without the static routes) the internet-bound traffic did go out via ens18, but I wasn't able to connect to the ens19 interface from my internal network (my laptop is on a different subnet to the server)



      My ip route output is



      default via 10.100.0.254 dev ens19 proto dhcp src 10.100.0.13 metric 100
      default via 10.1.2.254 dev ens18 proto dhcp src 10.1.2.3 metric 100
      10.1.2.0/24 dev ens18 proto kernel scope link src 10.1.2.3
      10.1.2.254 dev ens18 proto dhcp scope link src 10.1.2.3 metric 100
      10.100.0.0/24 dev ens19 proto kernel scope link src 10.100.0.13
      10.100.0.254 dev ens19 proto dhcp scope link src 10.100.0.13 metric 100


      And ip rule is



      0:      from all lookup local
      0: from 10.0.0.0/24 lookup 101
      0: from 10.0.1.0/24 lookup 101
      32766: from all lookup main
      32767: from all lookup default


      TL;DR
      I have an 18.04 server with 2 NICs, both assigned an address via DHCP (I'd rather keep it that way) but am unable to define both the default route to 0.0.0.0/0 and access the second interface from my internal network.



      Hope someone can help here. I found it much easier to do this with 16.04 and previous.







      18.04 netplan






      share|improve this question







      New contributor




      user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 22 at 16:49









      user895905

      1




      1




      New contributor




      user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      user895905 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.



























          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          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',
          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
          });


          }
          });






          user895905 is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095157%2fyet-another-netplan-question%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          user895905 is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          user895905 is a new contributor. Be nice, and check out our Code of Conduct.













          user895905 is a new contributor. Be nice, and check out our Code of Conduct.












          user895905 is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1095157%2fyet-another-netplan-question%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

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

           ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕