Error Summary: Virtual Machine static IP login + wireless Internet access, static IP
Environment: notebook + home WIFI + company WIFI + VMware + CentOS6.8 + Xshell
Problem description: When I was a beginner in Linux, I installed a Virtual Machine (single Nic) in my notebook. I wanted to connect linux to the company through wireless connection at home, however, you do not want to manually enter an IP address to log on to Xshell after the location changes.
Solution: Add a NIC (eth1) and set eth1 to VMnet1 (host-only in host mode) for Xshell logon. The original Nic eth0 is VMnet8 (NAT Mode)
Implementation Method:
Open the virtual network editor of the VM, view the VMnet1 subnet address, and manually change it to 11.11.11.0
Start Linux and log on as the root user.
Modify the eth0 configuration file
# Vim/etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE = eth0HWADDR = 00: 0C: 29: 97: 06: BCTYPE = EthernetUUID = 24e72ebf-5682-4a8f-87a4-6b53b39a5e0bONBOOT = yes # enable the NIC NM_CONTROLLED = yesBOOTPROTO = dhcp # ensure that the DHCP service is enabled to automatically obtain IP addresses
Modify the eth1 configuration file
# Vim/etc/sysconfig/network-scripts/ifcfg-eth1DEVICE = eth1 # Note HWADDR (MAC address) and UUID (universal Unique Identifier Universally Unique Identifier) cannot repeat with other NICs TYPE = EthernetONBOOT = yesNM_CONTROLLED = yesBOOTPROTO = static # static IP used for xshell remote logon IPADDR = 11.11.11.68 # VMnet1 subnet is 30 Segment NETMASK = 255.255.255.0 # GATEWAY = 11.11.11.1 my error: network Adapter eth1 cannot add Gateway
After the configuration is complete, restart the network service and check the network connection status.
#service network restart#ping www.qq.com
Ping indicates that the Internet can be connected. This solution is feasible.