❶ 涓嶆哕灏遍梾涓嬬粺淇″浘褰㈢晫闱㈡庝箞璁剧疆鍙岀绣鍗$粦瀹氾纴灏辨槸链嶅姟鍣ㄦ搷浣灭郴缁燂纻
锷熻兘姒傝堪
濡傛灉瀹㈡埛鐜板満浣跨敤镄勬槸鍙岀绣鍗$粦瀹氶厤缃缃戠粶锛岄渶瑕佹妸涓ゆ牴缃戝崱锅氱粦瀹氾纴姝ょ岖粦瀹氭柟寮忕О涓衡灭儹澶団濓纴鍗砨ond1妯″纺锛屽湪缁熶俊镎崭綔绯荤粺涓鎻愪緵浜嗗浘褰㈠寲镎崭綔鐣岄溃缁戝畾缃戝崱镄勬柟娉曘
镎崭綔姝ラ
1銆佸湪镎崭綔涓蹇-缃戠粶-链夌嚎缃戠粶涓锛岀偣鍑讳笅鏂圭殑鐢ㄧ绣缁灭$悊鍣ㄩ厤缃锛
2銆佹墦寮缃戠粶绠$悊鍣ㄩ厤缃钖庡备笅锲撅细
3銆佺偣鍑诲乏涓嬭掔殑钬+钬
阃夋嫨杩炴帴绫诲瀷涓虹粦瀹氾纴铹跺悗镣瑰嚮鍙充笅瑙掔殑create鎸夐挳锛
4銆佸湪钬灭粦瀹氲繛鎺1钬濈晫闱锛岀偣鍑籥dd鎸夐挳锛屾妸闇瑕佺粦瀹氢袱涓缃戝崱娣诲姞杩涘幓锛宫ode阃夋嫨钬灭儹澶団濓细
5銆佺偣鍑烩泪PV4璁剧疆阃夐”鍗♀濓纴method阃夋嫨镓嫔姩锛屽湪鍦板潃镙忕偣鍑籥dd鎸夐挳锛岃緭鍏ユ湇锷″櫒鐩稿叧镄刬p锛屽瓙缃戞帺镰侊纴缃戝叧淇℃伅锛
6銆侀厤缃瀹屾垚钖庣偣鍑讳缭瀛樻寜阍锛屽畬鎴愬弻缃戝崱缁戝畾璁剧疆銆傞厤缃瀹屾垚钖庡彲鍦ㄦ湇锷″櫒锻戒护琛宲ing缃戝叧锛屽苟浜ゆ浛𨰾旀帀涓涓鍏夌氦缃戠嚎娴嬭瘯缃戠粶鏄钖﹂氱晠銆
❷ 鑳藉惁鎸囧间竴涓嫔湪缁熶俊链嶅姟鍣ㄤ笂閰岖疆Dnsmasq浣滀负DNS链嶅姟鍣ㄧ殑鍏蜂綋姝ラわ纻
锷熻兘浠嬬粛
Dnsmasq鎻愪緵DNS缂揿瓨鍜娈HCP链嶅姟銆乀ftp链嶅姟锷熻兘锛
1銆佷綔涓哄烟钖嶈В鏋愭湇锷″櫒(DNS)锛娈nsmasq鍙浠ラ氲繃缂揿瓨DNS璇锋眰𨱒ユ彁楂桦硅块梾杩囩殑缃戝潃镄勮繛鎺ラ熷害锛
2銆佷綔涓箧HCP链嶅姟鍣锛娈nsmasq鍙浠ヤ负灞锘熺绣鐢佃剳鎻愪緵鍐呯绣ip鍦板潃鍜岃矾鐢憋绂
DNS鍜娈HCP涓や釜锷熻兘鍙浠ュ悓镞舵垨鍒嗗埆鍗旷嫭瀹炵幇銆侱nsmasq杞婚噺涓旀槗閰岖疆锛岄傜敤浜庝釜浜虹敤鎴锋垨灏戜簬50鍙颁富链虹殑缃戠粶锛屾ゅ栧畠杩樿嚜甯︿简涓涓狿XE链嶅姟鍣ㄣ
瀹夎呮ラ
姝ラや竴锛氩畨瑁 Dnsmasq
# UOS d鐗
$ apt install dnsmasq
# UOS a/e鐗
$ yum install dnsmasq
姝ラや簩锛氶厤缃鏂囦欢璇存槑
Dnsmasq閰岖疆鏂囦欢鏄/etc/dnsmasq.conf锛屼笅闱㈠笵nsmasq涓鍜娈NS鐩稿叧镄勯厤缃椤硅繘琛岃存槑锛
# 濡傛灉璁剧疆涓0锛屽垯瀹屽叏绂佹DNS锷熻兘锛屽彧浣跨敤dhcp链嶅姟
port=5353
# 浠庝笉杞鍙戞牸寮忛敊璇镄勫烟钖
#domain-needed
# 浠庝笉杞鍙戜笉鍦ㄨ矾鐢卞湴鍧涓镄勫烟钖
#bogus-priv
# resolv-file閰岖疆Dnsmasq棰濆栫殑涓婃父DNS链嶅姟鍣锛屽傛灉涓嶅紑钖灏变娇鐢╨inux涓绘満榛樿ょ殑/etc/resolv.conf閲岀殑nameserver锛岄氲繃涓嬮溃镄勯夐”鎸囧畾鍏朵粬鏂囦欢銆
resolv-file=/etc/dnsmasq.d/upstream_dns.conf
# 榛樿ゆ儏鍐典笅Dnsmasq浼氩彂阃佹煡璇㈠埌瀹幂殑浠讳綍涓婃父DNS链嶅姟鍣ㄤ笂锛屽傛灉鍙栨秷娉ㄩ喷锛屽垯Dnsmasq鍒欎细涓ユ牸鎸夌収/etc/resolv.conf涓镄凞NS Server椤哄簭杩涜屾煡璇銆
#strict-order
# 涓嶈诲彇 resolv-file 𨱒ョ‘瀹氢笂娓告湇锷″櫒
#no-resolv
# 涓嶈佹娴 /etc/resolv.conf 镄勫彉鍖
#no-poll
# 澧炲姞涓涓猲ame server锛屼竴鑸鐢ㄤ簬鍐呯绣锘熷悕
#server=/localnet/192.168.0.1
# 璁剧疆涓涓鍙嶅悜瑙f瀽锛屾墍链192.168.3.0/24镄勫湴鍧閮藉埌10.1.2.3铡昏В鏋
#server=/3.168.192.in-addr.arpa/10.1.2.3
# 澧炲姞涓涓链鍦板烟钖嶏纴浼氩湪/etc/hosts涓杩涜屾煡璇
#local=/localnet/
# 澧炲姞涓涓锘熷悕锛屽己鍒惰В鏋愬埌浣犳寚瀹氱殑鍦板潃涓
#address=/double-click.net/127.0.0.1
# 钖屼笂锛岃缮鏀鎸乮pv6
#address=/www.thekelleys.org.uk/fe80::20d:60ff:fe36:f83
# 澧炲姞镆ヨyahoo google鍜屽畠浠镄勫瓙锘熷悕鍒皏pn銆乻earch镆ユ垒
# 浣犺缮鍙浠ユ带鍒禗nsmasq鍜孲erver涔嬮棿镄勬煡璇浠庡摢涓缃戝崱鍑哄幓
# server=10.1.2.3@eth1
# 鎸囧畾婧愬湴鍧鎼哄甫10.1.2.3鍦板潃鍜192.168.1.1镄55绔鍙h繘琛岄氲
# 鏀瑰彉Dnsmasq榛樿ょ殑uid鍜実id
#user=
#group=
# 濡傛灉浣犳兂Dnsmasq鐩戝惉镆愪釜绔鍙d负dhcp銆乨ns鎻愪緵链嶅姟
#interface=
# 浣犺缮鍙浠ユ寚瀹氩摢涓绔鍙d綘涓嶆兂鐩戝惉
#except-interface=
# 璁剧疆𨱍崇洃钖镄勫湴鍧锛屽傛灉浣犳湰链鸿佷娇鐢ㄥ啓涓127.0.0.1銆
#listen-address=
# 濡傛灉浣犳兂鍦ㄦ煇涓绔鍙e彧鎻愪緵dns链嶅姟锛屽垯鍙浠ヨ繘琛岄厤缃绂佹dhcp链嶅姟
#no-dhcp-interface=
#bind-interfaces
# 濡傛灉浣犱笉𨱍充娇鐢/etc/hosts锛屽垯鍙栨秷涓嬮溃镄勬敞閲
#no-hosts
# 濡傛灉浣犻”璇诲彇鍏朵粬绫讳技/etc/hosts鏂囦欢锛屽垯杩涜岄厤缃
addn-hosts=/etc/banner_add_hosts
# 镊锷ㄧ殑缁檋osts涓镄刵ame澧炲姞涓涓锘熷悕
#expand-hosts
# 镊锷ㄥ姞杞絚onf-dir鐩褰曚笅镄勯厤缃鏂囦欢
conf-dir=/etc/dnsmasq.d
# 璁剧疆dns缂揿瓨澶у皬,榛樿や负150𨱒
cache-size=150
閰岖疆绀轰緥
姝ラや竴锛氶厤缃涓婃父链嶅姟鍣ㄥ湴鍧
resolv-file閰岖疆Dnsmasq棰濆栫殑涓婃父镄凞NS链嶅姟鍣锛屽傛灉涓嶅紑钖灏变娇鐢↙inux涓绘満榛樿ょ殑/etc/resolv.conf閲岀殑nameserver銆
阃氲繃涓嬮溃镄勯夐”鎸囧畾鍏朵粬鏂囦欢𨱒ョ$悊涓婃父镄凞NS链嶅姟鍣锛屼慨鏀/etc/dnsmasq.conf 閰岖疆鏂囦欢锛
resolv-file=/etc/resolv.dnsmasq.conf
鍦ㄦ寚瀹氭枃浠朵腑澧炲姞杞鍙慏NS镄勫湴鍧锛屼慨鏀/etc/resolv.dnsmasq.conf 鏂囦欢锛
nameserver 8.8.8.8
nameserver 8.8.4.4
链鍦板惎鐢―nsmasq瑙f瀽锛屼慨鏀 /etc/resolv.conf 鏂囦欢锛
nameserver 127.0.0.1
姝ラや簩锛氭坊锷犺В鏋愯板綍
1銆佷娇鐢ㄧ郴缁熼粯璁hosts锛屼慨鏀 /etc/hosts 鏂囦欢锛
127.0.0.1 localhost
192.168.101.107 web01.mike.com web01
192.168.101.107 web02.mike.com web02
2銆佷娇鐢ㄨ嚜瀹氢箟hosts鏂囦欢锛屼慨鏀/etc/dnsmasq.conf 閰岖疆鏂囦欢锛屽炲姞镊瀹氢箟 hosts 鏂囦欢浣岖疆锛
addn-hosts=/etc/dnsmasq.hosts
鏂板缓/etc/dnsmasq.hosts鏂囦欢锛屾坊锷燚NS璁板綍锛
192.168.101.107 web01.mike.com web01
192.168.101.107 web02.mike.com web02
3銆佷娇鐢ㄨ嚜瀹氢箟conf锛屾柊寤 /etc/dnsmasq.d/address.conf 鏂囦欢骞惰板綍濡备笅鍐呭癸细
# 鎸囧畾dnsmasq榛樿ゆ煡璇㈢殑涓婃父链嶅姟鍣锛屾ゅ勪互Google Public DNS涓轰緥銆
server=8.8.8.8
server=8.8.4.4
# 鎶婃墍链.cn镄勫烟钖嶅叏閮ㄩ氲繃114.114.114.114杩椤彴锲藉唴DNS链嶅姟鍣ㄦ潵瑙f瀽
server=/cn/114.114.114.114
# 缁檃pple.com鍜宼aobao.com浣跨敤涓撶敤镄凞NS
server=/taobao.com/223.5.5.5
server=/apple.com/223.5.5.5
# 鎶www.hi-linux.com瑙f瀽鍒扮壒瀹氱殑IP
address=/www.hi-linux.com/192.168.101.107
# 鍦ㄨ繖閲宧i-linux.com鐩稿綋浜*.hi-linux.com娉涜В鏋
address=/hi-linux.com/192.168.101.107
娉ㄦ槑锛氢篃鍙浠ョ洿鎺ユ坊锷犲埌/etc/dnsmasq.conf涓,涓嶈繃/etc/dnsmasq.d/*.conf镄勪紭鍏堢骇澶т簬/etc/dnsmasq.conf銆
姝ラや笁锛氩惎锷―nsmasq
1銆佸惎锷ㄦ湇锷★细
$ systemctl restart dnsmasq
2銆佹祴璇旸nsmasq瑙f瀽鏁堟灉锛
$ dig @192.168.101.104 www.hi-linux.com
❸ 统信 UOS 无线 感叹号 上网
打开网络和INERENT设置。
打开之后点击“更改适配器选项”,然后右击无线网络图标选择“禁用”,黄色感叹号消失没有。再点击右击无线网络图标选择“启用”,右击无线网络图标点击“属性”。
然后找到IPV4并点击“属性”。
最后一步,将图示的进行勾选之后并点击“确定”。