2023年9月6日 星期三

內網 TCP/IP 查詢 & ping 指令

 Windows系統 TCP/IP 查詢指令

 顯示所有介面卡的基本 TCP/IP 資訊

ipconfig  

 顯示所有介面卡的完整 TCP/IP 資訊

ipconfig /all  

 顯示ipconfig指令說明

ipconfig /?  

 其他指令說明參考

https://learn.microsoft.com/zh-tw/windows-server/administration/windows-commands/ipconfig  


 Linux系統 TCP/IP 查詢指令

 ip addr指令

 顯示所有介面卡的基本 TCP/IP 資訊

ip addr  

 或是

ip a  

 查詢個別介面卡的資訊

#查詢 eht0 介面卡資訊
ip addr show eth0  

 或是

#查詢 eht0 介面卡資訊
ip addr list eth0  

 指定介面卡定義 IP 地址

#設定 eht1 介面卡定義IP
sudo ip addr add 10.20.0.15/24 dev eth1  

 移除介面卡定義 IP 地址

#移除 eht1 介面卡定義IP
sudo ip addr del 10.20.0.15/24 dev eth1  

 啟用介面卡

#啟用 eth1 介面卡
sudo ip link set dev eth1 up  

 停用介面卡

#停用 eth1 介面卡
sudo ip link set dev eth1 down  

 ifconfig指令

 若無法執行ifconfig命令,先安裝net-tools

sudo apt install net-tools  

 顯示目前啟用介面卡的 TCP/IP 資訊

ifconfig  

 顯示所有介面卡的 TCP/IP 資訊

ifconfig -a  

 查詢個別介面卡的資訊

# 查看 enp0s3 網路介面
ifconfig enp0s3  

 設定網路介面 IP 位址與遮罩

# 設定 enp0s3 網路介面的 IP 位址與遮罩
sudo ifconfig enp0s3 192.168.5.100 netmask 255.255.255.0  


 ping 指令

 測試與目標主機連線

ping 8.8.8.8  

 或是

#不可輸入http、https、ftp 等協定抬頭
ping www.google.com  

 查詢 ping 指令說明

#windows版
ping /?

#Linux版
ping -h  

沒有留言:

張貼留言