i created a VM on my laptop using osboxes centos image 64 bit.
when i login ip link interfaces dont have any IP assigned.
when i do IP assignment to one of the interfaces which is UP , till the time i am logged in the IP is persistent.
what can i do to persist this IP? Any way even after restart of VM. i am using VM box.
make sure that there is a host-only network to connect to.
To check if you already have one, start VirtualBox and then click on the Global Tools button and make sure you are on the Host Manager Network tab.
Take note of the IP Address of the network and the network mask. For example in the screenshot below, the IP Address is 192.168.99.1 with network mask of 255.255.255.0 which means you can assign IP addresses 192.168.99.2-254 statically
Disable the DHCP server since you will assign IP addresses statically
make sure that the VM is shut down
in the VirtualBox app select the VM and click on the Settings button. Click on the Network tab. Adapter 1 should be your NAT adapter. Click on the Adapter 2 subtab, select Host-only Adapter and the name of the host-only network
Click OK and start up the VM. Log in as root through VirtualBox console. Run
$ ip addr
Create a file called ifcfg-enp0s8 in /etc/sysconfig/network-scripts/ and give it the following contents:
Note:
Where NETMASK should match the settings for your host-only network as obtained above and IPADDR should be an available IP address in the host-only network
Finally, you can restart and find that your IP does not change