[Ubuntu] 顯示使用中的 DNS Server 列表

顯示使用中的 DNS Server 列表

個人覺得最快也最簡單的方式就是直接 cat /etc/resolv.conf

執行後畫面輸出如下:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 192.168.1.1

 

如果有設定多個 DNS Server

則會出現多行 nameserver x.x.x.x

 

雖然網路上有不少人給的答案是利用 nmcli 去取得

但筆者測試固定 IP 或 DHCP Client 都沒有顯示 IP4.DNS

手邊的系統版本為 16.04.3 LTS (Xenial)


References:
Command-line to list DNS servers used by my system – Ask Ubuntu
networking – What DNS servers am I using? – Unix & Linux Stack Exchange

[CentOS] 加入第三方套件庫

如果想要安裝一個套件

不想透過自行編譯或是手動下載 RPM 套件包進行安裝的話

但是系統預設的套件庫又找不到想要安裝的套件時

可以透過加入第三方套件庫來解決這個問題

 

CentOS 官方 WIKI  可以找到一些可信任的第三方套件庫

本文以 Extra Packages for Enterprise Linux (EPEL) 作為範例實作。

Read more “[CentOS] 加入第三方套件庫”

[Ubuntu] dpkg: warning: files list file for package * missing; assuming package has no files currently installed

某天在 Ubuntu 上使用 apt-get install 安裝套件時狂噴 warning …

dpkg: warning: files list file for package 'node-lockfile' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libhtml-tagset-perl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'node-normalize-package-data' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'update-inetd' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'x11proto-dri2-dev' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'node-npmlog' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liblockfile-bin' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liblzma5:amd64' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'liblzma5:i386' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'python-gnupginterface' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libhttp-date-perl' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'libjs-node-uuid' missing; assuming package has no files currently installed
dpkg: warning: files list file for package 'pdksh' missing; assuming package has no files currently installed
# 族繁不及備載...

Read more “[Ubuntu] dpkg: warning: files list file for package * missing; assuming package has no files currently installed”

[Git] Unable to find remote helper for ‘https’

當使用 git 以 HTTPS 連線 clone repository 時出現 …

Unable to find remote helper for ‘https’

 

可能是在安裝 git 時因為缺少 libcurl 套件所導致

但是環境沒有 libcurl 時一樣可以安裝,只是會不能走 HTTPS 通道而已

 

若要修復這個問題,只需安裝 libcurl 後重新編譯安裝 git 就好:

# 系統為Ubuntu/Debain時,執行以下指令
apt-get install -y libcurl4-openssl-dev 

# 系統為CentOS/RedHat/Fedora時,執行以下指令
yum install -y libcurl-devel.x86_64

# 回到 git 原始碼目錄重新編譯並安裝 git
cd ~/git-2.8.16
./configure
make
make install

Reference: linux – “Unable to find remote helper for ‘https'” during git clone – Stack Overflow

[Ubuntu] 變更網路介面卡名稱

有時候新增網路卡後,看系統預設的名稱會不知道哪一張網路卡是做什麼用的

又或者是網路卡會跳號,龜毛人如我看了就會不舒服

就像這樣:

$ ifconfig -a
enp0s3    Link encap:Ethernet  HWaddr 08:00:27:51:3c:5b
          inet addr:192.168.56.101  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe51:3c5b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:51 errors:0 dropped:0 overruns:0 frame:0
          TX packets:69 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:7787 (7.7 KB)  TX bytes:9395 (9.3 KB)

enp0s8    Link encap:Ethernet  HWaddr 08:00:27:f4:06:a1
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

enp0s9    Link encap:Ethernet  HWaddr 08:00:27:7d:4c:81
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

 

我們可以藉由 Linux udev 將網路卡名稱更改成自己喜歡的名稱

Read more “[Ubuntu] 變更網路介面卡名稱”