最初捕获数据包时,您会在默认接口(以哪个为准)上看到流量。启用VPN时,设置过程的一部分是使VPN虚拟接口成为默认接口。根据您的系统,这意味着在列表中为VPN接口提供更高的routing metric或更高的routing priority。
启用VPN连接后,路由表应更改(请参见下文)。您还应该使用这些命令查看VPN连接的名称(作为新的默认接口),可以将其用作tcpdump的接口名称。请注意,根据您的系统/ VPN解决方案,您可能需要进行其他配置以获取必要的vpn接口名称。
各种系统上的路由指标
netstat -rn
将为您显示大多数系统(Windows,Macos,Linux,BSD等)上的路由表,但不会显示路由指标。
以下命令将向您显示路由指标(显示示例输出)。如您所见,在Ubuntu / Windows上,有一个路由度量标准号,但在Macos上,有一个路由顺序。在Macos中更改路由顺序的方法实际上是更改列表顺序,例如networksetup -ordernetworkservices service1,service2...
Ubuntu 18.04
$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.2.2 0.0.0.0 UG 100 0 0 enp0s3
10.0.2.0 0.0.0.0 255.255.255.0 U 100 0 0 enp0s3
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 enp0s3
Macos 10.15
$ networksetup -listnetworkserviceorder
An asterisk (*) denotes that a network service is disabled.
(1) AX88179 USB 3.0 to Gigabit Ethernet
(Hardware Port: AX88179 USB 3.0 to Gigabit Ethernet,Device: en5)
(2) Wi-Fi
(Hardware Port: Wi-Fi,Device: en0)
(3) Bluetooth PAN
(Hardware Port: Bluetooth PAN,Device: en3)
(4) Thunderbolt Bridge
(Hardware Port: Thunderbolt Bridge,Device: bridge0)
(5) Corporate VPN
(Hardware Port: L2TP,Device: )
Windows 10
C:\Users\rj>route print
===========================================================================
Interface List
5...08 00 27 04 b9 fa ......Intel(R) PRO/1000 MT Desktop Adapter
3...02 00 4c 4f 4f 50 ......Npcap Loopback Adapter
1...........................Software Loopback Interface 1
===========================================================================
IPv4 Route Table
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 10.0.2.2 10.0.2.15 25
10.0.2.0 255.255.255.0 On-link 10.0.2.15 281
10.0.2.15 255.255.255.255 On-link 10.0.2.15 281
...
本文链接:https://www.f2er.com/3079487.html