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.
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.
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}
/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 '18 at 18:32