In a virtual machine, the openSUSE system uses static IP configuration records to connect to the host through NAT.
View VM ip status
View the current ip address range and gateway information.
In this way, you can obtain the gateway information and the ip address range that can be set.
Gateway: 192.168.141.2
Ip address range: 192.168.128-254
Use the following command to set the IP address
Linux-6v32:/etc/sysconfig/network # ifconfig eth0 192.168.141.201 netmask 255.255.255.0 up
Linux-6v32:/etc/sysconfig/network # route add default gw 192.168.141.2
Test whether the configuration is successful
Linux-6v32:/etc/sysconfig/network # ping www.baidu.com
PING www.a.shifen.com (115.239.210.26) 56 (84) bytes of data.
64 bytes from 115.239.210.26: icmp_req = 1 ttl = 128 time = 31.2 MS
64 bytes from 115.239.210.26: icmp_req = 2 ttl = 128 time = 35.6 MS
64 bytes from 115.239.210.26: icmp_req = 3 ttl = 128 time = 37.5 MS
Done
It seems so simple. It took my brother nearly a day to do a good job. In the process, I tried a variety of methods to set them. All of them ended in failure... But now we are still successful, and we will not accept the previous exploration.