在 Windows 上正確地將介面 2 路由到介面 1,以便為其他主機提供 Internet 存取權限

在 Windows 上正確地將介面 2 路由到介面 1,以便為其他主機提供 Internet 存取權限

我的情況如圖所示:網路方案 在此輸入影像描述

我想讓centos虛擬機器能夠上網。我應該在 Windows shell 中輸入的正確命令是什麼?我已經在 regedit.exe 上啟用了 IPRouting。我在這裡放置了兩張路由表,一張是在我配置之後,一張是在啟用 Windows Internet 共用之後。看起來是同一件事,但第一個不起作用,第二個起作用。

    IPv4 Route Table
    ===========================================================================
    Active Routes:
    Network Destination        Netmask          Gateway       Interface  Metric
              0.0.0.0          0.0.0.0     192.168.40.2   192.168.40.129    266
            127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
            127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
      127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
          192.168.2.0    255.255.255.0         On-link     192.168.2.129    266
        192.168.2.129  255.255.255.255         On-link     192.168.2.129    266
        192.168.2.255  255.255.255.255         On-link     192.168.2.129    266
         192.168.40.0    255.255.255.0         On-link    192.168.40.129    266
       192.168.40.129  255.255.255.255         On-link    192.168.40.129    266
       192.168.40.255  255.255.255.255         On-link    192.168.40.129    266
            224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
            224.0.0.0        240.0.0.0         On-link    192.168.40.129    266
            224.0.0.0        240.0.0.0         On-link     192.168.2.129    266
      255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      255.255.255.255  255.255.255.255         On-link    192.168.40.129    266
      255.255.255.255  255.255.255.255         On-link     192.168.2.129    266
    ===========================================================================
    Persistent Routes:
      Network Address          Netmask  Gateway Address  Metric
              0.0.0.0          0.0.0.0     192.168.40.2  Default
    ===========================================================================
    ===========================================================================

    IPv4 Route Table
    ===========================================================================
    Active Routes:
    Network Destination        Netmask          Gateway       Interface  Metric
              0.0.0.0          0.0.0.0     192.168.40.2   192.168.40.129    266
            127.0.0.0        255.0.0.0         On-link         127.0.0.1    306
            127.0.0.1  255.255.255.255         On-link         127.0.0.1    306
      127.255.255.255  255.255.255.255         On-link         127.0.0.1    306
         192.168.40.0    255.255.255.0         On-link    192.168.40.129    266
       192.168.40.129  255.255.255.255         On-link    192.168.40.129    266
       192.168.40.255  255.255.255.255         On-link    192.168.40.129    266
        192.168.137.0    255.255.255.0         On-link     192.168.137.1    266
        192.168.137.1  255.255.255.255         On-link     192.168.137.1    266
      192.168.137.255  255.255.255.255         On-link     192.168.137.1    266
            224.0.0.0        240.0.0.0         On-link         127.0.0.1    306
            224.0.0.0        240.0.0.0         On-link    192.168.40.129    266
            224.0.0.0        240.0.0.0         On-link     192.168.137.1    266
      255.255.255.255  255.255.255.255         On-link         127.0.0.1    306
      255.255.255.255  255.255.255.255         On-link    192.168.40.129    266
      255.255.255.255  255.255.255.255         On-link     192.168.137.1    266
    ===========================================================================
    Persistent Routes:
      Network Address          Netmask  Gateway Address  Metric
              0.0.0.0          0.0.0.0     192.168.40.2  Default 
    ===========================================================================

相關內容