Hadoop [Lesson 1]: Configure the network address in virtual machine NAT mode

1. View the network segment

(1) Open the "Virtual Network Editor" of the virtual machine

Insert picture description here

(2) Select NAT mode→NAT settings

Insert picture description here

(3) Here you can see the network segment

Here you can see that the network segment is 192.168.184.0, so you can set the IP address of the virtual machine under this network segment. The gateway is set as shown in the figure.
Insert picture description here

2. Configure a static IP address

(1) Open the virtual machine, enter the terminal, and enter root;

(2) Find the network configuration file of your virtual machine

①Enter the following folder directory

# cd /etc/sysconfig/network-scripts/

②View the files in the folder

# ls

③ Mine is: ifcfg-ens32
Insert picture description here

(3) Modify the configuration file

①Open the configuration file

# vi ifcfg-ens32

②Enter "i" to start editing, and modify the following:

BOOTPROTO="static"
ONBOOT="yes"
IPADDR=192.168.184.114
GATEWAY=192.168.184.2
NETMASK=255.255.255.0
DNS1=192.168.184.2
DNS2=114.114.114.114

③After modifying, press Esc, enter ":wq", save and exit
Insert picture description here

(4) Restart the network

# service network restart

(5) Test whether the configuration is successful

# ping baidu.com

Output as shown in the figure below, which means the configuration is successful
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41315788/article/details/109263850