【Linux】CentOS设置静态IP(非动态获取IP)

在VMware上安装好Linux后,默认设置的动态IP,每次启动的IP都不同,远程连接挺费劲的。

于是,需要设置静态的IP,至少我从远程工具连接上去方便多了。另外,为了安装一些软件,也需要访问互联网。

> 版本说明

[nicchagil@localhost ~]$ cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

> VMware设置

虚拟机的网络配置:右击 > 设置 > 网络适配器 > 桥接模式(B):直接连接物理网络

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAlEAAADQCAIAAACobaPdAAAgAElEQVR4nO2deVQVV77v6+9+b7271r13vdf33r79evXrVvtGcxMxibE7MW3UTMaOMWnnMQTnKRrnqWOI4gTOQ5zBKEoUjaKAgogIyKyAMgsCKoMDk4zW+6MORZ09VR2gDnUO38/6rbN27dq1a1edOvtzdp1TVdKv/uW1X/3Lf/fr12/QoEGhoaEPHjyQAQAAAHdE+tU/v9avXz9fX9/i4uK9F1IRCAQCgXDXkH71z/89aNCg4uLifRfSEAgEAoFw45D69ev34MGD/SG3EQgEAoFw75D69ev34sWLHy/dQSAQCATCvUPq16+fLMsHL6cjEAgEAuHeYXPeodB0BAKBQCDcO2zOC4jI4kfY+FdeH+/PmrV+lDTsR02xUd9GZAVEZG2Z9fofZ4Ux8yWVtgWzvh0mDVqvFpY02Bak8u15ZfkWUfsRCAQCgcgKiMiyOe94ZDY/wieQvhm1WJm1YZQ07ICS+OOs8OMBK/447MDxyOyts17/46xwzeK28ltnvT5oQ/bxyGy1pKbM6xMCtIns45EHBqkraqtETahzDwx6ZcVWUfsRCAQCgcg+Hpltc96Ja7n8uDrxlb4Tj5P5S4apChy9xGd0j9lXlcz3fXJ9Z/d934coI0nDDqr5J46v7DHsIGNdPqOlV1b62iYPvi+NXtLWBsE4T10EgUAgEAhu2Jx3MiqPiKWf8h0jST3mRJyMyju5cYz06UElYcuJyjsZlbdtTt/BG1ur+mlVD2nMUiL/p1U9lAXVFX168OTGMVJryZNReSejIib1liRJknqv2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yEjzqMHaroDOEHldAMECxoZFNKttU0bspnFrklXyC0uPxGZeS4y6fefLPj0H+e/8ItfEHhv6Ezf2roXsixvOBKTkVcmbp/uBhhsIZAd2V0Gj3gzVg3cCYs7z9H7bfJMZmRMxtQMczTGXJDWFe8zxZMxvTqiJYJ1aZvHy+dtF3OH0Gsk5rrevcdkWX5YUbXlxI0HtfKX3wf+ceCoITP9Ju1NnHn6wXifc+ciUx5VVNfUNf5w6EZzc7Ndg4TQG+DoNndbBPuK3r26HxjeJO/9wjvVPbGy80A3xETnrdgVvOJQdEWLvCL43ltjl20MiJy7bu/n68+vvla36mzOyp1B6bllpeXVITdyTl3JELRPfwOEUgTGv0AQS4kzmd/mBN/48NZ0T+A8YClMdN5nK4Jm7IoKLJAXHb723uiFM9ft7//hmAl7Yn2TW3Ymvfhi8Y7K53U7AxMqn9XN8rlEtslwH42eVBfeLjIy7FN3Oz3Jq4f2HJzXnYHzgKUw0Xl/GLd/9t7owAJ50eHIfh9NGDlj1WuD/z5pb9zBTHl3csNfvTbIsrz7dKIsywu3hndkA9q9bDdB13nMLxZ0QubbSzy2g/O6M3AesBQmOu+3Y378aF340XvysoAb/+/Nj94Z4fn64NGLTqZHl8uHk6q++HaHzHGe7jhPUIA3HOzOGNxRvElitzPr1JaE84AWOA9Yiv8P5iYOc6fGQBIAAAAASUVORK5CYII=" alt="" />

> 设置静态地址、网关地址

由于与PC(非虚拟机)共享网络,所以查询PC所连接的网络相关信息,如默认网关

C:\Users\Administrator>ipconfig

Windows IP Configuration

Ethernet adapter 本地连接:

   Connection-specific DNS Suffix  . :
IPv4 Address. . . . . . . . . . . : 192.168.1.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

PC用着192.168.1.3,那么虚拟机用192.168.1.9吧,默认网关是192.168.1.1。

根据上述信息,开始修改Linux的3个配置,建议修改前备份。修改后的文件大概如下(HWADDR、UUID按照原来的文件配置即可)

[nicchagil@localhost ~]$ cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=localhost.localdomain
GATEWAY=192.168.1.1
[nicchagil@localhost ~]$ cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
# BOOTPROTO="dhcp"
BOOTPROTO="static"
IPADDR=192.168.1.9
NETMASK=255.255.255.0
HWADDR="YOUR MAC ADDRESS"
IPV6INIT="no"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="YOUR UUID"
DNS1=192.168.1.1
[nicchagil@localhost ~]$ cat /etc/resolv.conf
# Generated by NetworkManager # No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
nameserver 192.168.1.1

最后,重启网络

service network restart

> 测试

访问下百度看看

[nicchagil@localhost ~]$ curl www.baidu.com

如果顺利,就完成了静态IP的配置和上网。

如果不行,并且你是在后来才更改VMware的网络适配器为桥接模式的,请重启试试吧。

上一篇:【Linux】windows下编写的脚本文件,放到Linux中无法识别格式


下一篇:macos下使用rvm管理ruby版本和rails版本