1. Modify the IP
In the same LAN, the computer IP is not allowed to repeat.
1. The IP address configuration file of Ubuntu is in the netplan file under the etc directory.
So you need to modify the configuration in this YAML file.
If the NIC is a VM NIC, the initial configuration file may be as follows:
Ens33 in the figure above is the name of the network card. You can use the IP a command to view your computer’s network card. A real server has multiple network adapters. You need to configure an IP address for each network adapter.
If the nic is on the server, you do not need to configure the NIC. The configuration file is as follows:
Eth0 in the figure above is the name of the network card.
Modify the vm configuration file to:
Network: Ethernets: ens33: addresses: [192.168.10.120/24] gateway4: 192.168.10.2 Nameservers: addresses: [192.168.10.2] version: 2Copy the code
And save it.
Note that the gateway, gateway4, and DNS nameservers in the vm must be consistent with those in VMWare.
Location: VMWare home page — “edit –” virtual web editor
To put it into effect, run the following command:
netplan apply
Copy the code
At this point, the IP address is changed.
If other software is used to connect to the VM, the VM will be disconnected after the IP address is changed. In this case, change the IP address to a new one and connect to the VM again.
2. Change the host name
Computer names cannot be repeated on the same LAN.
1. Run the hostnameclt command to view the hostname.
2. The configuration file for making the host name change take effect is in the cloud. CFG file in the /etc/cloud directory, as follows:
Change the preserve_hostname of the file to true
Then save and exit.
3. Next, set the new host name by running the following command:
hostnamectl set-hostname ubuntu-gitlab
Copy the code
Ubuntu-gitlab is the new host name
4. Run the following command to configure hosts:
Cat >> /etc/hosts <<EOF 192.168.10.88 ubuntu-bt EOFCopy the code
Note: The IP above needs to be set earlier.
5. Then view the new host name:
3. Modify the DNS
The Ubuntu DNS configuration file is in the resolve-resolved. Conf file in the /etc/systemd directory and can be quickly accessed using the following command:
vi /etc/systemd/resolved.conf
Copy the code
Then modify it as follows:
Restart the system to take effect. Otherwise, the network cannot be connected.
reboot
Copy the code
End of article.