sudo vi /etc/sysconfig/network-scripts/ifcfg-eth0
EVICE=eth0
HWADDR=60:02:92:62:30:2A
TYPE=Ethernet
BROADCAST=10.36.0.255
UUID=b65f146c-d3ef-4f98-932b-ba3337a2590a
ONBOOT=yes
NM_CONTROLLED=yes
#BOOTPROTO=dhcp
IPADDR=10.36.0.148
NETMASK=255.255.255.0
GATEWAY=10.36.0.1
dhclient eth0获取DNS
DNS配置
linux用ifconfig命令也是看不到DNS的信息。(windows用ipconfig /all, 也可能是我不知道)
本机的DNS配置信息是在:/etc/resolv.conf
[root@localhost etc]#cat resolv.conf
nameserver xxx.xxx.xxx.xxx //这个就是你配置的或者是DHCP分配给你的DNS服务器地址,你也可以手动的修改此地址
dig和nslookup都能查
网关route add default gw {IP-ADDRESS} {INTERFACE-NAME}DNS编辑/etc/resolv.confnameserver {IP-ADDRESS}nameserver {IP-ADDRESS}
# Generated by NetworkManager
nameserver 210.22.70.3
nameserver 210.22.84.3
nameserver 223.5.5.5
nameserver 223.6.6.6
nameserver 1.2.4.8
nameserver 210.2.4.8
nameserver 8.8.8.8
nameserver 8.8.8.4
nameserver 208.67.222.222
nameserver 208.67.220.220
nameserver 114.114.114.114
nameserver 114.114.115.115
nameserver 112.124.47.27
nameserver 114.215.126.16
nameserver 101.226.4.6
nameserver 218.30.118.6
nameserver 208.67.222.222
nameserver 208.67.220.220
nameserver 199.91.73.222
nameserver 42.120.21.30
~
~
名称 | DNS 服务器 IP 地址 | |
---|---|---|
阿里 AliDNS | 223.5.5.5 | 223.6.6.6 |
CNNIC SDNS | 1.2.4.8 | 210.2.4.8 |
114 DNS | 114.114.114.114 | 114.114.115.115 |
oneDNS | 112.124.47.27 | 114.215.126.16 |
DNS 派 电信/移动/铁通 |
101.226.4.6 | 218.30.118.6 |
DNS 派 联通 | 123.125.81.6 | 140.207.198.6 |
Google DNS | 8.8.8.8 | 8.8.4.4 |
OpenDNS | 208.67.222.222 | 208.67.220.220 |
V2EX DNS | 199.91.73.222 | 178.79.131.110 |
OpenerDNS | 42.120.21.30 | (无添加剂) |
另外也可以通过setup来配置