Experimental environment: Physical NIC information Virtual Machine VMware Workstation14 Cent OS 6.7 x64 VMnet8 Information: 1. Modify VMware's network settings Location: Toolbar -> Edit -> Virtual Network Editor [Administrator] NAT Settings->Change Gateway IP(G): Change Subnet IP (I): Change Subnet mask (M): default 2. Enter Linux to modify network configuration Enter ip addr to view the network card information [root@localhost Desktop]# ip addr 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 inet 127.0.0.1/8 scope host lo inet6 ::1/128 scope host valid_lft forever preferred_lft forever 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000 link/ether 00:0c:29:3b:64:33 brd ff:ff:ff:ff:ff:ff inet 192.168.31.31/24 brd 192.168.31.255 scope global eth0 inet6 fe80::20c:29ff:fe3b:6433/64 scope link valid_lft forever preferred_lft forever 3: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN link/ether 1a:76:3b:91:89:e6 brd ff:ff:ff:ff:ff:ff <BROADCAST,MULTICAST,UP,LOWER_UP> The network card number eth0 before the mtu section is the NAT network card set up previously Adjust the network card script and enter the command DEVICE="eth0" BOOTPROTO="dhcp" HWADDR="00:0C:29:3B:64:33" IPV6INIT="yes" NM_CONTROLLED="yes" ONBOOT="no" TYPE="Ethernet" UUID="d2818ab1-7ee1-44bf-b8b9-5bbecc6880f0" Static IP mode: BOOTPROTO="static" Auto-start: ONBOOT="yes" Static IP information: IPADDR=192.168.123.123 //Select a non-conflicting IP in the network segment 192.168.123.x of the physical network card Subnet mask: NETMASK=255.255.255.0 Subnet gateway GATEWAY=192.168.163.2 Save after modification as follows DEVICE="eth0" BOOTPROTO="static" HWADDR="00:0C:29:3B:64:33" IPV6INIT="yes" NM_CONTROLLED="yes" ONBOOT="yes" TYPE="Ethernet" UUID="d2818ab1-7ee1-44bf-b8b9-5bbecc6880f0" IPADDR=192.168.123.123 NETMASK=255.255.255.0 GATEWAY=192.168.123.2 3. Restart the network card and check the status of the NAT network card in the Window network adapter Restart command: The previous automatic acquisition mode setting of VMnet8 properties has been (automatically) changed to the following state Note: Check whether the IP address is in the same network segment as the physical network card, and do not confuse this IP with the previous 192.168.123.123. The default xxx1 is fine. The default subnet mask is 255.255.255.0. If there is no default gateway, you can add it manually: 192.168.123.2 4. Make an SSH connection and fix the problem of being unable to access the external network Local execution: Test whether the external network is available after changing the static IP [root@localhost ~]# ping baidu.com ping: unknown host baidu.com Modify the DNS configuration information search localdomain nameserver 192.168.123.2 After saving, wait a moment and ping again [root@localhost ~]# ping baidu.com PING baidu.com.localdomain (220.181.38.148) 56(84) bytes of data. 64 bytes from 220.181.38.148: icmp_seq=1 ttl=128 time=45.5 ms 64 bytes from 220.181.38.148: icmp_seq=2 ttl=128 time=44.9 ms 64 bytes from 220.181.38.148: icmp_seq=3 ttl=128 time=45.4 ms 64 bytes from 220.181.38.148: icmp_seq=4 ttl=128 time=45.1 ms 64 bytes from 220.181.38.148: icmp_seq=5 ttl=128 time=45.2 ms 64 bytes from 220.181.38.148: icmp_seq=6 ttl=128 time=45.0 ms If the network card is restarted or the system allows DHCP to automatically obtain DNS, the previously modified DNS configuration will become invalid. Therefore, you need to add After the modification is completed, restart the network card References: *Detailed explanation of the solution to resolv.conf being reset after CentOS restart *Use xshell to connect to Linux in VMware Xshell 5 connects to the Linux system in the local virtual machine Solution to the problem that the VMware virtual machine cannot ping the external network after changing the static IP and eth0 is missing* *CentOS7 sets static IP and Windows can not ping the virtual machine, the virtual machine can not ping the external network solution Note: After the setting is successful, the NAT network card network segment and the physical network card network segment are inconsistent after the physical machine changes the IP, which will not affect the use This is the end of this article about the process of connecting to a local Linux virtual machine via SSH. For more relevant content about connecting to a local Linux via SSH, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: NodeJS realizes image text segmentation
>>: MySQL 8.0.20 installation and configuration detailed tutorial
As shown below: update table1 as z left join tabl...
Problem Description There is a type of query call...
Using ajax to implement form submission without re...
Table of contents 1. Basic event handling 2. Send...
Let's talk about the difference first last, t...
Form validation is one of the most commonly used ...
Table of contents Environment Preparation start 1...
1. Introduction When the amount of data in the da...
Vue $http get and post request cross-domain probl...
First, let’s understand what Docker is? Docker is...
The solution to the problem that the PHP7.3 versi...
Preface This article mainly explains how to imple...
1. Create tables <br /> First, create two t...
Aggregating data from various sources allows the ...
1. Element time selection submission format conve...