03-linux network configuration and system management operations

View network IP and gateway

Check out the virtual network editor
insert image description here
Edit->Virtual Network Editor:

Modify the ip address (modify the ip of the virtual network)
insert image description here
to view the gateway
insert image description here
VMware provides three network connection modes:

  • Bridge mode
    The mode in which the virtual machine is directly connected to the external physical network, and the host acts as a bridge. In this mode, the virtual machine can directly access the external network and is visible to the external network. The virtual machine and the host are in the same local area network. If there are a large number of clusters, the network address when DHCP distributes the IP address will not be enough, so the bridging mode is generally not used. (Network card: VMnet0)

  • NAT mode (Network Address Transition)
    The virtual machine and the host build a private network, and convert IP through a virtual network address translation (NAT) device. The virtual machine can access the external network through the shared host IP, but the external network cannot access the virtual machine. It is equivalent to creating a virtual route. There are two protocols of NAT and DHCP inside the route. The route is connected to the host virtually. At this time, the host is somewhat equivalent to the external network. It can be understood as a virtual LAN inside the host’s LAN ( for use by VMware). But there is a problem, the host cannot access the VM. At this time, VMware virtualizes a network card for the host, and the address is under the virtual router, so that the host in the VM can be accessed. This virtual router is VMnet8.
    insert image description here

  • Host-only mode
    The virtual machine only shares a private network with the host and cannot communicate with external networks. The host in the VM cannot access the external network. A virtual network card is VMnet1.

Modifying the network configuration under the command line

[haven@192 ~]$ vim /etc/sysconfig/network-scripts/ifcfg-ens33
直接进入到对网络配置修改的vim编辑器里面

insert image description here
You can change the dynamically assigned address to a static address to facilitate the host's access to the virtual machine.
insert image description here
Mainly modify IPADDR, GATEWAY, DNS1 three locations need to be added.
After saving and exiting, proceed

service network restart   #重启网络服务
reboot					#重启系统

Problems caused by changing the IP address

  1. The physical machine can ping the virtual machine, but the virtual machine can ping different physical machines, usually because of the firewall problem of the physical machine, just turn off the firewall.
  2. The virtual machine can ping the physical machine, but the virtual machine can ping a different external network, usually because of a problem with the DNS settings.
  3. Ping www.baidu.com of the virtual machine shows that the domain name is unknown, etc. Generally, check whether the GATEWAY and DNS settings are correct.
  4. If all the above settings are still not working, you need to close the NetworkManager service (systemctl stop NetworkManager #close; systemctl disable NetworkManager #disable)
  5. If the check finds that there is a problem with the systemctl status network, you need to check ifcfg-ens33

modify hostname

hostname  #显示hostname的名字
vim  /etc/hostname   #修改主机名
hostnamectl     #显示hostname详细信息
hostnamectl set- hostname spqrk10   #设置hostname的名字为spark10

remote login

Use ssh to log in to remote login
ssh root@hadoop #Use ssh to log in to the remote server, ssh password-free login, followed by the login root and hostname (user identity)

Usually in the course of work, employees other than operation and maintenance personnel are not allowed to directly contact the real server or cloud server used in the company, so remote login is required to operate. Therefore, remote login tools are indispensable. At present, the mainstream ones include Xshell, SSH Secure Shell, SecureCRT, FinalShell, etc. You can choose according to your habits. (Both are based on the SSH protocol for login)

Guess you like

Origin blog.csdn.net/qq_40500099/article/details/126217831
Recommended