
我的 ISP 為我提供了用於互聯網訪問的靜態 IP 範圍:123.123.123.120-125
(Debian) /etc/network/interfaces:
auto eth1
iface eth1 inet static
address 123.123.123.120
netmask 255.255.255.0
gateway 123.123.123.254
dns-nameservers 8.8.8.8
當我去外部網站檢查我的 IP 位址時,它沒有報告 123.123.123.120,事實上外部 IP 檢查顯示我的是 23.23.23.45,這與 ISP 給我的不同。不過我還是可以正常上網。 (Traceroute 顯示 23.23.23.45 也屬於我的 ISP)
這台 Linux 機器旁的 Windows 機器使用 123.123.123.125 設置,網站外部 IP 檢查顯示 123.123.123.125
我懷疑 ISP 使用某種高級代理?難道只有Linux機器能辨識真實IP而Windows機器不能辨識嗎?
所以我做了另一個測試,我設定了一台Windows 機器並使用相同的ip 123.123.123.120,我將乙太網路線從Linux 機器拔到Windows 機器,運行ip 檢查並且ip 檢查報告正確,它報告123.123. 123.120。
Linux機器上出現這種奇怪現象的原因是什麼?
這是我的 /etc/network/interfaces:
**筆記:eth0 和 eth2 用於 virtualbox 虛擬網路卡橋接,所以我只是將其註解掉並保留它們
# The loopback network interface
auto lo
iface lo inet loopback
## eth0 TPLink Realtek
# auto eth0
# iface eth0 inet static
# address 10.10.10.10
# netmask 255.0.0.0
# eth1 mobo intel nic
auto eth1
iface eth1 inet static
address 61.xx.yy.zz
netmask 255.255.255.0
gateway 61.xx.yy.254
dns-nameservers 8.8.8.8
## eth2 intel nic
# auto eth2
# iface eth2 inet static
# address 10.10.20.20
# netmask 255.0.0.0
和我的 ifconfig:
eth0 Link encap:Ethernet HWaddr a0:f3:c1:00:52:50
inet6 addr: fe80::a2f3:c1ff:fe00:5250/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:131 errors:0 dropped:0 overruns:0 frame:0
TX packets:57 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:13885 (13.5 KiB) TX bytes:14304 (13.9 KiB)
Interrupt:42 Base address:0x4000
eth1 Link encap:Ethernet HWaddr 30:85:a9:a7:a0:bb
inet addr:61.xx.yy.zz Bcast:61.xx.yy.255 Mask:255.255.255.0
inet6 addr: fe80::3285:a9ff:fea7:a0bb/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:339 errors:0 dropped:0 overruns:0 frame:0
TX packets:279 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:53807 (52.5 KiB) TX bytes:23917 (23.3 KiB)
Interrupt:18 Memory:f7e00000-f7e20000
eth2 Link encap:Ethernet HWaddr 00:1b:21:39:1f:e1
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::21b:21ff:fe39:1fe1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:643 errors:0 dropped:0 overruns:0 frame:0
TX packets:418 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:72405 (70.7 KiB) TX bytes:43037 (42.0 KiB)
Interrupt:16 Memory:f7dc0000-f7de0000
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:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:1104 (1.0 KiB) TX bytes:1104 (1.0 KiB)
答案1
使用 ping 和 traceroute 以及 tcpdump 進行雙向檢查 - 從您的 Linux 機器到外部節點並返回。嘗試例如https://www.whatismyip.com/……使用 HTTPS,而不是 HTTP。並且...詢問 ISP 是否有任何位址轉換或 (http) 代理。 :)
編輯:也許您的瀏覽器正在(自動)配置為使用代理。檢查例如,tcpdump -i eth1 port 80
看看您的瀏覽器是否直接與目標伺服器通訊。