Tag: Linux

[Linux]利用nslookup指定DNS查詢Domain

總該有個前因

今天遇到一個突發狀況,DNS(Domain Name Server)上的子網域設定突然失效導致客戶無法使用子網域下的服務

在查明是DNS的問題之前,腦海中有閃過一個指令是可以用來指定DNS查詢Domain

後來詢問Google大神才喚醒我的記憶

在解決這個突發狀況的時候nslookup幫了我很大的忙

正好趁這個機會重溫一下nslookup這個指令

我記得第一次接觸它是在大學修網路概論課的時候

一句話說明nslookup的作用

nslookup是用來查詢網路上的DNS

我們都知道網路上有非常多DNS,常見的有:

中華電信

  • 168.95.1.1
  • 168.95.192.1

Google

  • 8.8.8.8
  • 8.8.4.4

我們在本機可以設定要去哪一台DNS查詢Domain

那如果在不更動本機的DNS設定下,可以使用別台的DNS來查詢Domain嗎?

答案是Yes, 對!就是利用nslookup

如何使用nslookup

nslookup提供interactive和non-interactive兩種模式來查詢

non-interactive

nslookup google.com #使用本機設定的DNS查詢google.com這個domain
nslookup google.com 8.8.8.8 #到8.8.8.8這台DNS查詢google.com這個domain

interactive

nslookup
> server 8.8.8.8 #指定DNS
> google.com 8.8.8.8 #查詢google.com這個domain

以上兩種方式都有人在用,看個人習慣

自己比較偏好第二個

How to Enable Virtualbox 5.0 Shared Folder on Debian 8.5 Guest OS Step By Step

真的花了超多時間才解決這個問題!

前置作業:

  1. Devices > Insert Guest Additions CD image
  2. 切換到root權限

掛載剛剛插入的Guest Additions CD映像檔

mount /dev/sr0 /mnt

確認掛應像檔的內容

cd /mnt
ls -al

執行VBoxLinuxAdditions.run

./VBoxLinuxAdditions.run

若出現以下內容表示安裝失敗:

The make utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module …fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)

檢查安裝紀錄檔

tail /var/log/vboxadd-install.log

內容如下:

/opt/VBoxGuestAdditions-5.0.24/src/vboxguest-5.0.24/build_in_tmp: 62: /opt/VBoxGuestAdditions-5.0.24/src/vboxguest-5.0.24/build_in_tmp: make: not found

重點是後面的make: not found
看起來是還沒裝make,安裝make

apt-get install make

再執行一次VBoxLinuxAdditions.run

./VBoxLinuxAdditions.run

結果還是安裝失敗

The gcc utility was not found. If the following module compilation fails then
this could be the reason and you should try installing it.

The headers for the current running kernel were not found. If the following
module compilation fails then this could be the reason.

Building the main Guest Additions module …fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Doing non-kernel setup of the Guest Additions …done.

再檢查一次/var/log/vboxadd-install.log

tail /var/log/vboxadd-install.log

看起來來是少裝了一些東西,爬了一些文章看到這篇試著安裝DKMS就搞定了

/tmp/vbox.0/Makefile.include.header:97: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.

安裝dkms

apt-get install dkms

再執行一次VBoxLinuxAdditions.run

./VBoxLinuxAdditions.run

若沒有出現任何的錯誤訊息就重啟VM

確認/media目錄的內容,看到sf_xxx目錄表示設定成功了!
virtualbox_shared_folder

來源和目的伺服器都需要有rsync

bash: rsync: command not found
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: remote command not found (code 127) at io.c(226) [Receiver=3.1.1]

之前使用rsync一直遇到這個問題

很納悶的是我的本機端明明有安裝rsync但怎麼會噴command not found

後來看到這篇文章才知道由於來源端(source)和目的端(destination)都要使用rsync溝通

所以使用rsync看到上述的錯誤訊息先檢查來源和目的端是否都有安裝rsync

因為某些Linux Distribution預設不會安裝rsync

安裝指令:

apt-get install rsync