所有 TCP/IP 主機皆有路由表,決定封包轉發路徑。重啟後自動重建,永久(靜態)項會自動重新插入。
route print
輸出欄位:Network Address、Netmask、Gateway Address、Interface、Metric。
Active Routes:
Network Address Netmask Gateway Address Interface Metric
0.0.0.0 0.0.0.0 10.1.1.254 10.1.1.3 1 <- 預設網關
10.1.0.0 255.255.0.0 10.1.1.3 10.1.1.3 1 <- 本地網段
10.1.1.3 255.255.255.255 127.0.0.1 127.0.0.1 1 <- 本機回環
127.0.0.1 255.0.0.0 127.0.0.1 127.0.0.1 1
224.0.0.0 224.0.0.0 10.1.1.3 10.1.1.3 1 <- 多播
255.255.255.255 255.255.255.255 10.1.1.3 10.1.1.3 1 <- 廣播
route print 對比文檔記錄的永久項。route delete 移除或 route change 修正。route -p add 192.168.5.0 mask 255.255.255.0 192.168.1.1 ! -p 持久化
route -p delete 192.168.5.0
-p 參數寫入登錄,重啟後保留;否則僅當前會話生效。