VMware-NAT模式下靜態IP設置

1.NAT簡單介紹

    NAT(Network Address Translation),實現本機系統和虛擬系統的雙向訪問。但網絡內其餘機器不能訪問虛擬系統,虛擬系統可經過本機系統用NAT協議訪問網絡內其餘機器。在VM中由VMnet8提供IP,Gateway和DNS。 shell

2.NAT靜態IP簡單設置

    a.查看nat模式下虛擬機的DNS

[root@rhel6 ~]# vi /etc/resolv.conf 
# Generated by NetworkManager
search local
nameserver 192.168.102.2  

    b.設置靜態IP

[root@rhel6 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
ONBOOT=yes
#NM_CONTROLLED=no
BOOTPROTO=static
#BOOTPROTO=dhcp
IPADDR=192.168.102.136
BROADCAST=192.168.102.255
NETMASK=255.255.255.0
HWADDR=00:0C:29:9C:68:3D
GATEWAY=192.168.102.2
DNS1=192.168.102.2    

    c.重啓network

[root@rhel6 ~]# /etc/init.d/network restart
Shutting down interface eth0:  Device state: 3 (disconnected)
                                                           [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:  Active connection state: activated
Active connection path: /org/freedesktop/NetworkManager/ActiveConnection/5
                                                           [  OK  ]

   d.查看是否設置成功

        ifconfig 網絡

    好處:設置靜態IP有利於採用虛擬機開發和調試。 oop

  
相關文章
相關標籤/搜索