/etc/resov.conf域名解析dns配置文件,和/etc/hosts本地域名解析文件

[root@fortress02-new etc]# 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 8.8.8.8

nameserver 4.4.4.4

search localdomain


系统优先识别网卡配置文件中dns解析地址,如果没有配置,则去/etc/resolv.conf读取dns的ip地址。

[root@fortress02-new etc]# cat /etc/sysconfig/network-scripts/ifcfg-em1

# Generated by dracut initrd

DEVICE="em1"

ONBOOT=yes

NETBOOT=yes

UUID="17277656-0c5f-4d24-9eb9-ed30ba59d145"

BOOTPROTO=static

IPADDR=122.x.x.2

NETMASK=255.255.255.248

GATEWAY=122.x.x.1

HWADDR="e8:9a:8f:50:4f:40"

TYPE=Ethernet

NAME="em1"

DNS1=8.8.8.8

DNS2=202.106.0.20


IPADDR1=122x.x.3

PREFIX1=29


IPADDR2=122.x.x.4

PREFIX1=29



二、本地host域名解析

[root@fortress02-new etc]# cat /etc/hosts

127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

122.x.x.2:8888   jira.moxxg.com


实践经验:

以后大型服务器集群,最好使用本地域名解析,开发只需要使用固定域名,日后机房迁移,IP改变后只需要修改本地/etc/hosts的映射,例如

淘宝开发时都是指定域名,不使用ip,换机房或服务器后,修改程序中对应ip,麻烦。

taobao:

172.38.18.23     realtime-search.config-vip.taobao.com


你可能感兴趣的:(域名解析,resolv.conf)