2023年6月27日 星期二

Get Public IP Address from OpenDNS

一般取得所在 Public IP 都是用 Web 服務取得,例如:
curl ip4.tw
curl ifconfig.co

OpenDNS 有提供一個服務,對他們的 name server 查 myip.opendns.com 會回應來源 IP
dig +short myip.opendns.com @resolver1.opendns.com
host myip.opendns.com resolver1.opendns.com

發現若環境同時有 IPv4+IPv6 可能會不正常,因為兩個 IP 都有的話,通常會走 IPv6 的路由,用 IPv6 路由去查 A 記錄導致無資料

保險一點,指令要區分 IPv4、IPv6
dig -4 +short A myip.opendns.com @resolver1.opendns.com
dig -6 +short AAAA myip.opendns.com @resolver1.opendns.com

2023年6月18日 星期日

Import Rocky Linux 9 to WSL

需先安裝 XZ Utils for Windows 把 xz.exe 放在 PATH 有指到的地方

curl -LOs https://github.com/rocky-linux/sig-cloud-instance-images/raw/Rocky-9.2.20230513-Base-x86_64/layer.tar.xz
上面的 layer.tar.xz 是官方的網址,其他版本網址可到 sig-cloud-instance-images 選擇 Branch
xz -d layer.tar.xz
wsl --import RockyLinux9 D:\WSL\RockyLinux9 layer.tar
Distro 名稱 RockyLinux9 及資料目錄名稱 D:\WSL\RockyLinux9 請依自身環境調整
wsl -d RockyLinux9
即完成進入 RockyLinux9 WSL

ref. Import any Linux distribution to use with WSL

New SSH client to old SSH server

從新版 SSH 8.x 連到舊版 6.x SSH server 若出現 Unable to negotiate with x.x.x.x port 22: no matching host key type found. Their offer: ssh-rsa,ssh-dss ...