我有两台服务器服务器A和服务器B。服务器B是服务器A的VPN。当服务器A位于服务器B的VPN后面时,如何在服务器B上找到服务器A的本地IP?我认为当我发出命令“ifconfig”时应该列出它,但我不太确定当时我正在寻找哪个IP。
ifconfig -a 的输出
gre0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-8C-B9-00-00-00-00-00-00-00-00
NOARP MTU:1476 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:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
gretap0 Link encap:Ethernet HWaddr 00:00:00:00:00:00
BROADCAST MULTICAST MTU:1476 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)
ip6tnl0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
NOARP MTU:1460 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:0
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:377 errors:0 dropped:0 overruns:0 frame:0
TX packets:377 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:76799 (76.7 KB) TX bytes:76799 (76.7 KB)
tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:10.8.0.1 P-t-P:10.8.0.1 Mask:255.255.255.0
UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1
RX packets:8726841 errors:0 dropped:0 overruns:0 frame:0
TX packets:7897879 errors:0 dropped:22138 overruns:0 carrier:0
collisions:0 txqueuelen:100
RX bytes:6123986424 (6.1 GB) TX bytes:6479665617 (6.4 GB)
venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255
inet6 addr: 2604:180:2:127b::2ed4/64 Scope:Global
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
RX packets:18726387 errors:0 dropped:0 overruns:0 frame:0
TX packets:16971835 errors:0 dropped:799 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:13379179118 (13.3 GB) TX bytes:13281478025 (13.2 GB)
venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00
inet addr:107.191.96.157 P-t-P:107.191.96.157 Bcast:107.191.96.157 Mask:255.255.255.255
UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1
答案1
从标签来看,我猜您正在运行 OpenVPN。 OpenVPN 使用 tun 或 tap 隧道,因此tun0
.那么你的本地 IP(在 VPN 上)是 10.8.0.1,这很奇怪(因为它让我觉得是一个配置错误)也是对等 IP。
BTW:在 Linux 上,ifconfig
(朋友)基本上已经过时并被ip
命令取代。ip addr ls
会给你所有的地址。