How do i assign Ubuntu 18.04 a static ip, its in a virtual machine using VMware and host is Windows

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





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty margin-bottom:0;







up vote
0
down vote

favorite












I've tried for hours to statically assign an ip but nothing works. Does the network adapter in Vmware have to be set to Nat or Bridged? When I try bridged I never get internet connection. Also I read Ubuntu 17+ uses Netplan? Someone please point me in the correct direction.







share|improve this question





















  • No need to do it externally. Just use the common default way (NAT) and add in the guest OS under /etc/network/interface.d/ a configuration file for the relevant interface. The contents of the file should look like in the section [Configuring the interface manually] wiki.debian.org/NetworkConfiguration
    – marc
    Jul 18 at 18:32

















up vote
0
down vote

favorite












I've tried for hours to statically assign an ip but nothing works. Does the network adapter in Vmware have to be set to Nat or Bridged? When I try bridged I never get internet connection. Also I read Ubuntu 17+ uses Netplan? Someone please point me in the correct direction.







share|improve this question





















  • No need to do it externally. Just use the common default way (NAT) and add in the guest OS under /etc/network/interface.d/ a configuration file for the relevant interface. The contents of the file should look like in the section [Configuring the interface manually] wiki.debian.org/NetworkConfiguration
    – marc
    Jul 18 at 18:32













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I've tried for hours to statically assign an ip but nothing works. Does the network adapter in Vmware have to be set to Nat or Bridged? When I try bridged I never get internet connection. Also I read Ubuntu 17+ uses Netplan? Someone please point me in the correct direction.







share|improve this question













I've tried for hours to statically assign an ip but nothing works. Does the network adapter in Vmware have to be set to Nat or Bridged? When I try bridged I never get internet connection. Also I read Ubuntu 17+ uses Netplan? Someone please point me in the correct direction.









share|improve this question












share|improve this question




share|improve this question








edited Jul 18 at 19:47









Theodore Weld

32




32









asked Jul 18 at 18:09









user1871

42




42











  • No need to do it externally. Just use the common default way (NAT) and add in the guest OS under /etc/network/interface.d/ a configuration file for the relevant interface. The contents of the file should look like in the section [Configuring the interface manually] wiki.debian.org/NetworkConfiguration
    – marc
    Jul 18 at 18:32

















  • No need to do it externally. Just use the common default way (NAT) and add in the guest OS under /etc/network/interface.d/ a configuration file for the relevant interface. The contents of the file should look like in the section [Configuring the interface manually] wiki.debian.org/NetworkConfiguration
    – marc
    Jul 18 at 18:32
















No need to do it externally. Just use the common default way (NAT) and add in the guest OS under /etc/network/interface.d/ a configuration file for the relevant interface. The contents of the file should look like in the section [Configuring the interface manually] wiki.debian.org/NetworkConfiguration
– marc
Jul 18 at 18:32





No need to do it externally. Just use the common default way (NAT) and add in the guest OS under /etc/network/interface.d/ a configuration file for the relevant interface. The contents of the file should look like in the section [Configuring the interface manually] wiki.debian.org/NetworkConfiguration
– marc
Jul 18 at 18:32











1 Answer
1






active

oldest

votes

















up vote
0
down vote













check out the post from @Ahsan.Amin in https://askubuntu.com/questions/984445/netplan-configuration-on-ubuntu-17-04-virtual-machine?rq=1 since he provided a working netplan and therefore the solution to my problem. :)



To give you an overview these are the steps that allowed me to set a NAT and host only connection in Virtualbox. I hope you can adapt them to VMWare.



If you simply want to be able to access the VM (guest OS) from your host (e.g. Windows 10 OS) use host-only adapter and NAT to access the internet from your guest OS. Therefore set the first network adapter to NAT and the second one to host-only network.



enter image description here



enter image description here



enter image description here



Check with ifconfig on your VM for your ethernet name mine is enp0s3 for NAT and enp0s8 for host-only. Simply my network adapter order.



In order to use the network manager, create a netplan.yml (sudo nano PLAN-NAME.yaml) in etc/netplan/ and set the file to something like this:



network:
ethernets:
enp0s3:
addresses:
dhcp4: true
enp0s8:
addresses: [192.168.78.2/24]
dhcp4: no
dhcp6: no
nameservers:
addresses: [8.8.8.8,8.8.4.4]
version: 2
renderer: networkd


Addresses containing the static IP of the current VM. Check the host adapter for its IP and modify the addresses parameter to your needs.



It is really really important not to set the gateway4 parameter. It prevented me from accessing the internet.



After you created the plan.yaml, run:



sudo netplan apply


Test everything by pinging google



ping -c 4 8.8.8.8


and using Putty / MobaXterm to connect to your VM (use IP from addresses).



PS: It might be that you also need to create 99-disable-network-config.cfg in /etc/cloud/cloud.cfg.d/ containing:



network: config: disable






share|improve this answer























    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    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: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    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%2funix.stackexchange.com%2fquestions%2f457064%2fhow-do-i-assign-ubuntu-18-04-a-static-ip-its-in-a-virtual-machine-using-vmware%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
    0
    down vote













    check out the post from @Ahsan.Amin in https://askubuntu.com/questions/984445/netplan-configuration-on-ubuntu-17-04-virtual-machine?rq=1 since he provided a working netplan and therefore the solution to my problem. :)



    To give you an overview these are the steps that allowed me to set a NAT and host only connection in Virtualbox. I hope you can adapt them to VMWare.



    If you simply want to be able to access the VM (guest OS) from your host (e.g. Windows 10 OS) use host-only adapter and NAT to access the internet from your guest OS. Therefore set the first network adapter to NAT and the second one to host-only network.



    enter image description here



    enter image description here



    enter image description here



    Check with ifconfig on your VM for your ethernet name mine is enp0s3 for NAT and enp0s8 for host-only. Simply my network adapter order.



    In order to use the network manager, create a netplan.yml (sudo nano PLAN-NAME.yaml) in etc/netplan/ and set the file to something like this:



    network:
    ethernets:
    enp0s3:
    addresses:
    dhcp4: true
    enp0s8:
    addresses: [192.168.78.2/24]
    dhcp4: no
    dhcp6: no
    nameservers:
    addresses: [8.8.8.8,8.8.4.4]
    version: 2
    renderer: networkd


    Addresses containing the static IP of the current VM. Check the host adapter for its IP and modify the addresses parameter to your needs.



    It is really really important not to set the gateway4 parameter. It prevented me from accessing the internet.



    After you created the plan.yaml, run:



    sudo netplan apply


    Test everything by pinging google



    ping -c 4 8.8.8.8


    and using Putty / MobaXterm to connect to your VM (use IP from addresses).



    PS: It might be that you also need to create 99-disable-network-config.cfg in /etc/cloud/cloud.cfg.d/ containing:



    network: config: disable






    share|improve this answer



























      up vote
      0
      down vote













      check out the post from @Ahsan.Amin in https://askubuntu.com/questions/984445/netplan-configuration-on-ubuntu-17-04-virtual-machine?rq=1 since he provided a working netplan and therefore the solution to my problem. :)



      To give you an overview these are the steps that allowed me to set a NAT and host only connection in Virtualbox. I hope you can adapt them to VMWare.



      If you simply want to be able to access the VM (guest OS) from your host (e.g. Windows 10 OS) use host-only adapter and NAT to access the internet from your guest OS. Therefore set the first network adapter to NAT and the second one to host-only network.



      enter image description here



      enter image description here



      enter image description here



      Check with ifconfig on your VM for your ethernet name mine is enp0s3 for NAT and enp0s8 for host-only. Simply my network adapter order.



      In order to use the network manager, create a netplan.yml (sudo nano PLAN-NAME.yaml) in etc/netplan/ and set the file to something like this:



      network:
      ethernets:
      enp0s3:
      addresses:
      dhcp4: true
      enp0s8:
      addresses: [192.168.78.2/24]
      dhcp4: no
      dhcp6: no
      nameservers:
      addresses: [8.8.8.8,8.8.4.4]
      version: 2
      renderer: networkd


      Addresses containing the static IP of the current VM. Check the host adapter for its IP and modify the addresses parameter to your needs.



      It is really really important not to set the gateway4 parameter. It prevented me from accessing the internet.



      After you created the plan.yaml, run:



      sudo netplan apply


      Test everything by pinging google



      ping -c 4 8.8.8.8


      and using Putty / MobaXterm to connect to your VM (use IP from addresses).



      PS: It might be that you also need to create 99-disable-network-config.cfg in /etc/cloud/cloud.cfg.d/ containing:



      network: config: disable






      share|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        check out the post from @Ahsan.Amin in https://askubuntu.com/questions/984445/netplan-configuration-on-ubuntu-17-04-virtual-machine?rq=1 since he provided a working netplan and therefore the solution to my problem. :)



        To give you an overview these are the steps that allowed me to set a NAT and host only connection in Virtualbox. I hope you can adapt them to VMWare.



        If you simply want to be able to access the VM (guest OS) from your host (e.g. Windows 10 OS) use host-only adapter and NAT to access the internet from your guest OS. Therefore set the first network adapter to NAT and the second one to host-only network.



        enter image description here



        enter image description here



        enter image description here



        Check with ifconfig on your VM for your ethernet name mine is enp0s3 for NAT and enp0s8 for host-only. Simply my network adapter order.



        In order to use the network manager, create a netplan.yml (sudo nano PLAN-NAME.yaml) in etc/netplan/ and set the file to something like this:



        network:
        ethernets:
        enp0s3:
        addresses:
        dhcp4: true
        enp0s8:
        addresses: [192.168.78.2/24]
        dhcp4: no
        dhcp6: no
        nameservers:
        addresses: [8.8.8.8,8.8.4.4]
        version: 2
        renderer: networkd


        Addresses containing the static IP of the current VM. Check the host adapter for its IP and modify the addresses parameter to your needs.



        It is really really important not to set the gateway4 parameter. It prevented me from accessing the internet.



        After you created the plan.yaml, run:



        sudo netplan apply


        Test everything by pinging google



        ping -c 4 8.8.8.8


        and using Putty / MobaXterm to connect to your VM (use IP from addresses).



        PS: It might be that you also need to create 99-disable-network-config.cfg in /etc/cloud/cloud.cfg.d/ containing:



        network: config: disable






        share|improve this answer















        check out the post from @Ahsan.Amin in https://askubuntu.com/questions/984445/netplan-configuration-on-ubuntu-17-04-virtual-machine?rq=1 since he provided a working netplan and therefore the solution to my problem. :)



        To give you an overview these are the steps that allowed me to set a NAT and host only connection in Virtualbox. I hope you can adapt them to VMWare.



        If you simply want to be able to access the VM (guest OS) from your host (e.g. Windows 10 OS) use host-only adapter and NAT to access the internet from your guest OS. Therefore set the first network adapter to NAT and the second one to host-only network.



        enter image description here



        enter image description here



        enter image description here



        Check with ifconfig on your VM for your ethernet name mine is enp0s3 for NAT and enp0s8 for host-only. Simply my network adapter order.



        In order to use the network manager, create a netplan.yml (sudo nano PLAN-NAME.yaml) in etc/netplan/ and set the file to something like this:



        network:
        ethernets:
        enp0s3:
        addresses:
        dhcp4: true
        enp0s8:
        addresses: [192.168.78.2/24]
        dhcp4: no
        dhcp6: no
        nameservers:
        addresses: [8.8.8.8,8.8.4.4]
        version: 2
        renderer: networkd


        Addresses containing the static IP of the current VM. Check the host adapter for its IP and modify the addresses parameter to your needs.



        It is really really important not to set the gateway4 parameter. It prevented me from accessing the internet.



        After you created the plan.yaml, run:



        sudo netplan apply


        Test everything by pinging google



        ping -c 4 8.8.8.8


        and using Putty / MobaXterm to connect to your VM (use IP from addresses).



        PS: It might be that you also need to create 99-disable-network-config.cfg in /etc/cloud/cloud.cfg.d/ containing:



        network: config: disable







        share|improve this answer















        share|improve this answer



        share|improve this answer








        edited Jul 19 at 15:16


























        answered Jul 19 at 15:05









        lars

        11




        11






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f457064%2fhow-do-i-assign-ubuntu-18-04-a-static-ip-its-in-a-virtual-machine-using-vmware%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay