1、求一個linux shell腳本,把域名解析為ip然後echo出來。
|# ./get_ip.sh
./get_ip.sh need a parameter
# ./get_ip.sh e.cn
202.112.0.36
# cat get_ip.sh
#!/bin/sh
if [ $# -lt 1 ]; then
echo $0 need a parameter
exit 0
fi
ADDR=$1
TMPSTR=`ping ${ADDR} packetsize 1 | grep ${ADDR} | head -n 1`
echo ${TMPSTR} | cut -d'(' -f 2 | cut -d')' -f1
2、如何解決Linux無法解析域名問題
是所有域名都無法解析還是就單獨的一兩個無法解析。
要是全部都無法解析的話,建議更換DNS配置。
要是就一兩個無法解析的話,建議把這兩個域名添加到hosts裡面。
3、linux 獲取域名ip的方法
^1、用ping/nslookup/dig都能解析ip
2、實例getip.sh
#!/bin/sh
name=$1
if [ -z $1 ];then
echo Usage:$0 dns
exit 1
fi
dig $name|grep ^$name|awk '{print $5}'
3、./getip.sh 一個域名
4、linux bind,如何配置能夠解析不帶域名的host主機名。
從你提供的系統看你的bind應該是可以支持Response Policy Zone (RPZ) Rewriting策略的。
把主機名都寫在rpz的zone里應該是可以實現的。
例如
response-policy { zone "badlist"; };
and this zone statement
zone "badlist" {type master; file "master/badlist"; allow-query {none;}; };
with this zone file
$TTL 1H
@ SOA LOCALHOST. named-mgr.example.com (1 1h 15m 30d 2h)
NS LOCALHOST.
; QNAME policy records. There are no periods (.) after the owner names.
server1 A 10.0.0.1
5、Linux下DNS無法解析問題
1、vi /etc/resolv.conf 在裡面直接添加
nameserver 202.96.128.68 //DNS地址
2、查看路由:route -n看看網關是否正確
6、如何把域名解析到自己的linux主機
任何域名要訪問網站都需要兩個步驟,一是域名解析到空間IP上,而是空間綁定域名。。。你的阿里雲在主機管理上會有一項綁定域名的,或者進入獨立面板綁定。樓主做的什麼站吶。
7、我的Linux不能解析域名怎麼辦?
我的是debian,
$
cat
/etc/resolv.conf
結果類似
nameserver
211.134.22.17
nameserver
211.10.17.5
您看一下這個文件內容,手動添加dns地址,就能解析的
8、linux操作系統訪問域名需要配置什麼嗎?
redhat 系列配置dns 位置在 /etc/resolv.conf , resolv.conf 寫法 :
nameserver 192.168.1.1
還要注意dns 的查詢方式 /etc/nsswitch.conf :
hosts: files mdns4_minimal dns
9、Linux域名解析
你已經作對了啊,就是做A記錄指到你的IP就行了。
只是生效需要一段時間而已。
剛Ping了一下,www.feelworld.com指向的IP是82.98.86.175,你的IP應該是173.231.6.89,那把這個A記錄的IP改一下就行了