Centos fixed ip in vm virtual machine

After fixing the ip, I found that the ssh connection always times out, and I can only connect occasionally. After adding the local ip to the hosts file of the virtual machine, it is better
. The network connection mode of the virtual machine is set to NAT (VMnet8) to
   view the gateway ip- ---192.168.68.2
Second, change the configuration file (it will take effect without restarting)
/etc/sysconfig/network
Specify the gateway, add GATEWAY=192.168.68.2

to fix the IP
vim /etc/sysconfig/network-scripts/ifcfg-eth0

DEVICE="eth0"
#BOOTPROTO="dhcp"
BOOTPROTO="static"
IPADDR=192.168.68.133
NETMASK=255.255.255.0
HWADDR="00:0C:29:4A:EF:2D"
IPV6INIT="no"
NM_CONTROLLED="yes "
ONBOOT="yes"
TYPE="Ethernet"
UUID="f5d439ad-1707-4bf7-80ae-4efbdea30633"
DNS1=192.168.68.2

3. ubuntu fixed ip
http://blog.csdn.net/kellycan/article/details/6325064

4. The machine cannot access the project on the virtual machine
Bridge mode
Close the firewall
service iptables stop (centos6.6)

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326647698&siteId=291194637