通过 MacBook 作为互联网路由器路由 Windows 10 流量

通过 MacBook 作为互联网路由器路由 Windows 10 流量

我尝试将 MacBook Pro(2015 年中,macOS High Sierra,v.10.13.6)配置为 Win 10 笔记本电脑的互联网路由器。

我的配置:

以太网电缆通过 ThunderBolt 以太网适配器将 Win 10 笔记本电脑以太网端口直接连接到 MacBook ThunderBolt 端口。MacBook 通过 WiFi 使用 Frigate StrongSwan VPN 访问互联网。

为了配置 ThunderBolt 以太网接口,我尝试了“MacBook 系统偏好设置/网络”提供的几个选项。选项“DHCP”和“手动地址的 DHCP”都不起作用,所以我最终使用 ThunderBolt 以太网接口的“手动”配置,我设置如下:

IP地址:192.168.0.17

子网 Nask:255.255.255.0

DNS 服务器:8.8.8.8, 8.8.4.4

在此处输入图片描述

路由器:我无法确定路由器 IP 地址。我尝试使用从 Mac 上的“netstat -nr”输出中获得的 WiFi 路由器地址:

$ netstat -nr
Routing tables

Internet:
Destination        Gateway            Flags        Refs      Use   Netif Expire
default            link#13            UCS            99        0  ipsec0
default            192.168.1.1        UGScI           5        0     en0
default            link#11            UCSI            0        0 bridge0
8.8.4.4            link#13            UHWIi           8    11865  ipsec0
8.8.8.8            link#13            UHWIi           7     8148  ipsec0
10.10.10.14        10.10.10.14        UH              0        0  ipsec0
17.57.144.89       link#13            UHWIi           1       80  ipsec0
17.242.179.27      link#13            UHW3I           0       29  ipsec0     95
17.253.127.206     link#13            UHW3I           0       18  ipsec0     99
20.65.133.230      link#13            UHWIi           1     1207  ipsec0
40.99.169.162      link#13            UHW3I           0       22  ipsec0    186
40.126.53.16       link#13            UHW3I           0        3  ipsec0     58
52.96.57.98        link#13            UHW3I           0       29  ipsec0    125
52.96.121.194      link#13            UHWIi           1      350  ipsec0
52.96.121.242      link#13            UHW3I           0        8  ipsec0      3
52.168.117.171     link#13            UHW3I           0        3  ipsec0      6
104.18.32.7        link#13            UHWIi           1       50  ipsec0
104.18.37.228      link#13            UHW3I           0       98  ipsec0     73
104.18.40.222      link#13            UHWIi           1      798  ipsec0
104.18.41.158      link#13            UHW3I           0       10  ipsec0     38
104.18.131.236     link#13            UHWIi           1      183  ipsec0
104.26.9.177       link#13            UHWIi           1      182  ipsec0
127                127.0.0.1          UCS             0        0     lo0
127.0.0.1          127.0.0.1          UH              2      206     lo0
142.250.113.94     link#13            UHW3I           0      240  ipsec0    163
142.250.113.95     link#13            UHW3I           0      253  ipsec0    201
142.250.113.97     link#13            UHW3I           0       97  ipsec0     76
142.250.113.99     link#13            UHW3I           0       90  ipsec0     88
142.250.113.100    link#13            UHW3I           0       14  ipsec0     85
142.250.113.113    link#13            UHW3I           0       56  ipsec0    112
142.250.113.132    link#13            UHW3I           0      311  ipsec0     88
142.250.113.157    link#13            UHW3I           0       24  ipsec0     33
142.250.114.83     link#13            UHW3I           0       50  ipsec0    158
142.250.114.95     link#13            UHW3I           0      106  ipsec0     76
142.250.114.102    link#13            UHW3I           0       33  ipsec0    142
142.250.114.154    link#13            UHWIi           1       10  ipsec0
142.250.114.156    link#13            UHW3I           0       42  ipsec0    125
142.250.115.95     link#13            UHWIi           2      659  ipsec0
142.250.115.101    link#13            UHW3I           0      296  ipsec0     76
142.250.115.103    link#13            UHW3I           0        6  ipsec0     81
142.250.115.132    link#13            UHW3I           0      171  ipsec0    163
142.250.115.136    link#13            UHWIi           1     3710  ipsec0
142.250.115.139    link#13            UHWIi           1      225  ipsec0
142.250.115.156    link#13            UHW3I           0       40  ipsec0    131
142.250.115.157    link#13            UHW3I           0      514  ipsec0    171
142.250.138.95     link#13            UHW3I           0       10  ipsec0     55
142.250.138.154    link#13            UHW3I           0      450  ipsec0     84
142.251.116.113    link#13            UHWIi           1       26  ipsec0
142.251.116.148    link#13            UHW3I           0      231  ipsec0    125
142.251.116.149    link#13            UHW3I           0       46  ipsec0     84
142.251.116.154    link#13            UHW3I           0      793  ipsec0    158
142.251.116.155    link#13            UHW3I           0       80  ipsec0    138
142.251.116.156    link#13            UHWIi           2       55  ipsec0
142.251.116.188    link#13            UHWIi           1      137  ipsec0
146.75.104.193     link#13            UHWIi           1      390  ipsec0
149.154.167.92     link#13            UHWIi           6     4201  ipsec0
167.88.166.234     192.168.1.1        UGHS       160848    80453     en0
169.254            link#6             UCS             0        0     en0
169.254            link#5             UCSI            0        0     en4
172.64.144.177     link#13            UHWIi           1      470  ipsec0
172.64.155.141     link#13            UHW3I           0       21  ipsec0     32
172.64.155.249     link#13            UHWIi           2      257  ipsec0
185.137.235.93     link#13            UHWIi           1      275  ipsec0
192.0.73.2         link#13            UHW3I           0      243  ipsec0     34
192.168.0          link#5             UCS             1        0     en4
192.168.0.17/32    link#5             UCS             0        0     en4
192.168.0.18       88:a4:c2:f3:6d:41  UHLWIi          1    92896     en4   1157
192.168.1          link#6             UCS             2        0     en0
192.168.1.1/32     link#6             UCS             1        0     en0
192.168.1.1        28:ff:3e:dd:4f:2d  UHLWIir         2      406     en0    748
192.168.1.3        cc:47:40:cb:f:58   UHLWI           0        3     en0
192.168.1.6        96:e4:87:ed:fa:67  UHLWI           0        3     en0    748
192.168.1.9/32     link#6             UCS             0        0     en0
192.168.2          link#11            UC              1        0 bridge0
192.178.49.163     link#13            UHWIi           6     2688  ipsec0
192.178.50.35      link#13            UHWIi           2      114  ipsec0
194.226.130.227    link#13            UHWIi           1      389  ipsec0
198.252.206.25     link#13            UHWIi           1      417  ipsec0
216.239.32.116     link#13            UHWIi           3       96  ipsec0
224.0.0/4          link#13            UmCS            1        0  ipsec0
224.0.0/4          link#5             UmCSI           0        0     en4
224.0.0/4          link#6             UmCSI           1        0     en0
224.0.0.251        1:0:5e:0:0:fb      UHmLWI          0        0     en0
239.255.255.250    link#13            UHmW3I          0      736  ipsec0    145
255.255.255.255/32 link#13            UCS             0        0  ipsec0
255.255.255.255/32 link#5             UCSI            0        0     en4
255.255.255.255/32 link#6             UCSI            0        0     en0


使用默认网关 192.168.1.1 作为 ThunderBolt 以太网路由器导致全部MacBook 上的路由,WiFi 连接停止工作。

在 Win 10 笔记本电脑上,我使用以下以太网设置:

IP:192.168.0.18

子网掩码:255.255.255.0

默认网关:192.168.0.17

首选 DNS 服务器:192.168.0.17

在此处输入图片描述

无需在 ThunderBolt 上指定路由器,我就可以建立 Win10 和 MacBook 之间的连接,并且可以在两个方向上 ping 通:

Pinging 192.168.0.17 with 32 bytes of data:
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64
Reply from 192.168.0.17: bytes=32 time<1ms TTL=64

 $ ping 192.168.0.18
PING 192.168.0.18 (192.168.0.18): 56 data bytes
64 bytes from 192.168.0.18: icmp_seq=0 ttl=128 time=1.283 ms
64 bytes from 192.168.0.18: icmp_seq=1 ttl=128 time=1.395 ms
64 bytes from 192.168.0.18: icmp_seq=2 ttl=128 time=1.250 ms
...

但是我无法从 Windows 众所周知的公共 IP 地址 ping 通,例如 208.67.222.222 和 208.67.220.220(OpenDNS)、1.1.1.1 和 1.0.0.1(Cloudflare)、8.8.8.8 和 8.8.4.4(Google DNS)

这意味着 MacBook 没有从 192.168.0.17 到外界的路由。(当然 DNS 也不能正常工作,显然在路由工作之前我无法测试 DNS)。

如何在MacBook上设置从192.168.0.17到外界的路由?

相关内容