Defining Static IP addresses for Multiple NIC adapters

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP








up vote
0
down vote

favorite












Just would like to understand how you define static IP addresses for Ubuntu 17.10 server with multiple NIC adapters (i.e.eth0 and eth1) using the /etc/netplan directory. (basically a continuance from this post Ubuntu 17.10 will not accept static IP and thanks to everyone who answered this also)



here's an example of my new /etc/netplan/01-netcfg.yaml which works a treat.



# This file describes the network interfaces available on your system
# For more information, see netplan(5).
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
dhcp6: no
addresses: [192.168.10.254/24]
gateway4: 192.168.10.1
nameservers:
addresses: [192.168.10.1,192.168.10.252]


how would I define eth1 so it could be on a different subnet (e.g 192.168.20.10/24)?



thanks in advance also!










share|improve this question

























    up vote
    0
    down vote

    favorite












    Just would like to understand how you define static IP addresses for Ubuntu 17.10 server with multiple NIC adapters (i.e.eth0 and eth1) using the /etc/netplan directory. (basically a continuance from this post Ubuntu 17.10 will not accept static IP and thanks to everyone who answered this also)



    here's an example of my new /etc/netplan/01-netcfg.yaml which works a treat.



    # This file describes the network interfaces available on your system
    # For more information, see netplan(5).
    network:
    version: 2
    renderer: networkd
    ethernets:
    eth0:
    dhcp4: no
    dhcp6: no
    addresses: [192.168.10.254/24]
    gateway4: 192.168.10.1
    nameservers:
    addresses: [192.168.10.1,192.168.10.252]


    how would I define eth1 so it could be on a different subnet (e.g 192.168.20.10/24)?



    thanks in advance also!










    share|improve this question























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Just would like to understand how you define static IP addresses for Ubuntu 17.10 server with multiple NIC adapters (i.e.eth0 and eth1) using the /etc/netplan directory. (basically a continuance from this post Ubuntu 17.10 will not accept static IP and thanks to everyone who answered this also)



      here's an example of my new /etc/netplan/01-netcfg.yaml which works a treat.



      # This file describes the network interfaces available on your system
      # For more information, see netplan(5).
      network:
      version: 2
      renderer: networkd
      ethernets:
      eth0:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.10.254/24]
      gateway4: 192.168.10.1
      nameservers:
      addresses: [192.168.10.1,192.168.10.252]


      how would I define eth1 so it could be on a different subnet (e.g 192.168.20.10/24)?



      thanks in advance also!










      share|improve this question













      Just would like to understand how you define static IP addresses for Ubuntu 17.10 server with multiple NIC adapters (i.e.eth0 and eth1) using the /etc/netplan directory. (basically a continuance from this post Ubuntu 17.10 will not accept static IP and thanks to everyone who answered this also)



      here's an example of my new /etc/netplan/01-netcfg.yaml which works a treat.



      # This file describes the network interfaces available on your system
      # For more information, see netplan(5).
      network:
      version: 2
      renderer: networkd
      ethernets:
      eth0:
      dhcp4: no
      dhcp6: no
      addresses: [192.168.10.254/24]
      gateway4: 192.168.10.1
      nameservers:
      addresses: [192.168.10.1,192.168.10.252]


      how would I define eth1 so it could be on a different subnet (e.g 192.168.20.10/24)?



      thanks in advance also!







      networking 17.10 ip-address netplan






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Feb 25 at 21:51









      Josho

      153




      153




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          The simple way, just duplicate another stanza like you have right now for your eth0, but call it eth1. Note, this assumes your cards are named 'eth0' and 'eth1' reliably:



           # <<Existing config from question goes here>>
          eth1:
          # Note, "dhcp4/6: no" not needed
          addresses: [192.168.20.10/24]
          gateway4: 192.168.20.1
          nameservers:
          addresses: [192.168.20.1,192.168.20.252]


          Complete Example:



          # This file describes the network interfaces available on your system
          # For more information, see netplan(5).
          network:
          version: 2
          renderer: networkd
          ethernets:
          eth0:
          # Note, "dhcp4/6: no" not needed
          addresses: [192.168.10.254/24]
          gateway4: 192.168.10.1
          nameservers:
          addresses: [192.168.10.1,192.168.10.252]
          eth1:
          # Note, "dhcp4/6: no" not needed
          addresses: [192.168.20.10/24]
          gateway4: 192.168.20.1
          nameservers:
          addresses: [192.168.20.1,192.168.20.252]


          If you find that your cards /dev/<ifname> gives you fits, you can also match the stanza on mac address, or other properties. Adding something like the following under the correct device stanza will help. See netplan(5) for more information:



           match:
          macaddress: 00:11:22:33:44:55





          share|improve this answer




















            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: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1009747%2fdefining-static-ip-addresses-for-multiple-nic-adapters%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            1
            down vote



            accepted










            The simple way, just duplicate another stanza like you have right now for your eth0, but call it eth1. Note, this assumes your cards are named 'eth0' and 'eth1' reliably:



             # <<Existing config from question goes here>>
            eth1:
            # Note, "dhcp4/6: no" not needed
            addresses: [192.168.20.10/24]
            gateway4: 192.168.20.1
            nameservers:
            addresses: [192.168.20.1,192.168.20.252]


            Complete Example:



            # This file describes the network interfaces available on your system
            # For more information, see netplan(5).
            network:
            version: 2
            renderer: networkd
            ethernets:
            eth0:
            # Note, "dhcp4/6: no" not needed
            addresses: [192.168.10.254/24]
            gateway4: 192.168.10.1
            nameservers:
            addresses: [192.168.10.1,192.168.10.252]
            eth1:
            # Note, "dhcp4/6: no" not needed
            addresses: [192.168.20.10/24]
            gateway4: 192.168.20.1
            nameservers:
            addresses: [192.168.20.1,192.168.20.252]


            If you find that your cards /dev/<ifname> gives you fits, you can also match the stanza on mac address, or other properties. Adding something like the following under the correct device stanza will help. See netplan(5) for more information:



             match:
            macaddress: 00:11:22:33:44:55





            share|improve this answer
























              up vote
              1
              down vote



              accepted










              The simple way, just duplicate another stanza like you have right now for your eth0, but call it eth1. Note, this assumes your cards are named 'eth0' and 'eth1' reliably:



               # <<Existing config from question goes here>>
              eth1:
              # Note, "dhcp4/6: no" not needed
              addresses: [192.168.20.10/24]
              gateway4: 192.168.20.1
              nameservers:
              addresses: [192.168.20.1,192.168.20.252]


              Complete Example:



              # This file describes the network interfaces available on your system
              # For more information, see netplan(5).
              network:
              version: 2
              renderer: networkd
              ethernets:
              eth0:
              # Note, "dhcp4/6: no" not needed
              addresses: [192.168.10.254/24]
              gateway4: 192.168.10.1
              nameservers:
              addresses: [192.168.10.1,192.168.10.252]
              eth1:
              # Note, "dhcp4/6: no" not needed
              addresses: [192.168.20.10/24]
              gateway4: 192.168.20.1
              nameservers:
              addresses: [192.168.20.1,192.168.20.252]


              If you find that your cards /dev/<ifname> gives you fits, you can also match the stanza on mac address, or other properties. Adding something like the following under the correct device stanza will help. See netplan(5) for more information:



               match:
              macaddress: 00:11:22:33:44:55





              share|improve this answer






















                up vote
                1
                down vote



                accepted







                up vote
                1
                down vote



                accepted






                The simple way, just duplicate another stanza like you have right now for your eth0, but call it eth1. Note, this assumes your cards are named 'eth0' and 'eth1' reliably:



                 # <<Existing config from question goes here>>
                eth1:
                # Note, "dhcp4/6: no" not needed
                addresses: [192.168.20.10/24]
                gateway4: 192.168.20.1
                nameservers:
                addresses: [192.168.20.1,192.168.20.252]


                Complete Example:



                # This file describes the network interfaces available on your system
                # For more information, see netplan(5).
                network:
                version: 2
                renderer: networkd
                ethernets:
                eth0:
                # Note, "dhcp4/6: no" not needed
                addresses: [192.168.10.254/24]
                gateway4: 192.168.10.1
                nameservers:
                addresses: [192.168.10.1,192.168.10.252]
                eth1:
                # Note, "dhcp4/6: no" not needed
                addresses: [192.168.20.10/24]
                gateway4: 192.168.20.1
                nameservers:
                addresses: [192.168.20.1,192.168.20.252]


                If you find that your cards /dev/<ifname> gives you fits, you can also match the stanza on mac address, or other properties. Adding something like the following under the correct device stanza will help. See netplan(5) for more information:



                 match:
                macaddress: 00:11:22:33:44:55





                share|improve this answer












                The simple way, just duplicate another stanza like you have right now for your eth0, but call it eth1. Note, this assumes your cards are named 'eth0' and 'eth1' reliably:



                 # <<Existing config from question goes here>>
                eth1:
                # Note, "dhcp4/6: no" not needed
                addresses: [192.168.20.10/24]
                gateway4: 192.168.20.1
                nameservers:
                addresses: [192.168.20.1,192.168.20.252]


                Complete Example:



                # This file describes the network interfaces available on your system
                # For more information, see netplan(5).
                network:
                version: 2
                renderer: networkd
                ethernets:
                eth0:
                # Note, "dhcp4/6: no" not needed
                addresses: [192.168.10.254/24]
                gateway4: 192.168.10.1
                nameservers:
                addresses: [192.168.10.1,192.168.10.252]
                eth1:
                # Note, "dhcp4/6: no" not needed
                addresses: [192.168.20.10/24]
                gateway4: 192.168.20.1
                nameservers:
                addresses: [192.168.20.1,192.168.20.252]


                If you find that your cards /dev/<ifname> gives you fits, you can also match the stanza on mac address, or other properties. Adding something like the following under the correct device stanza will help. See netplan(5) for more information:



                 match:
                macaddress: 00:11:22:33:44:55






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Feb 25 at 23:44









                dpb

                4,90911545




                4,90911545



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1009747%2fdefining-static-ip-addresses-for-multiple-nic-adapters%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    Trouble downloading packages list due to a “Hash sum mismatch” error

                    How do so many people here on Academia.SE, and in general, afford lavish higher education programs?

                    How do I move numbers in filenames, in a batch renaming operation?