如何在一台 Windows 7 PC 上正确支持两张网卡?

如何在一台 Windows 7 PC 上正确支持两张网卡?

我已经从 Vista 升级到 Windows 7。在 Vista 上,我曾经运行一张网卡(Intel 82566DC -2 Gigabit)用于互联网,该网卡连接到与 3G 调制解调器连接的 Dovado USB 移动宽带路由器。卡上的 IP 设置设置在 DHCP 上。第二张卡(3com 以太网链路)用于连接到我们镇的本地 WUG(无线用户组),一切运行正常。

现在我在使用 Windows 7 时遇到的问题是,当我使用 (Intel) 第一块卡连接到互联网时,互联网工作正常,但当我将第二块卡连接到 wug 时,互联网就断线了。如果我断开第一块卡(互联网卡)的连接并尝试连接到 wug,它就可以正常工作。

看起来这两张卡在互相争斗。我能做些什么来解决这个问题吗?从这篇文章中你可能已经知道,我不是 PC 专家,所以如果你要回答的话,请用简单的术语来回答。:)

答案1

删除第二个接口上的专用网络网关。我有一段时间遇到同样的问题,所以我的无线网络接口与互联网的网关为 192.168.1.0/24,网关为 192.168.1.1,我的专用网关为 10.0.0.0/8,没有网关。

如果您在不同的网络上设置了 2 个网关,并且 NIC 的窗口将通过带宽最高的 NIC 发送所有出站流量,而不管指标如何(至少在我的情况下)

由于无线仅为 G 型(54Mpbs),而有线为 GigE(1000Mbps),因此它通过有线连接发送所有流量。

一旦我取出私有网络网关(仅保留静态 IP 和子网),我仍然可以浏览互联网并访问我的私人文件服务器。

但是,如果您将私有网络 NIC 运行到路由器中,则插入路由器的任何设备都将无法访问互联网。

我设置网络的方式是将第一个有线网卡插入路由器的 WAN 端口,然后在 Windows 中将该网卡和无线网卡桥接。然后,我将第二个有线网卡插入路由器的一个端口,并仅配置 IP 和子网。

这使得我的文件服务器仍然可以访问互联网,并允许我访问它,同时仍然保持整个有线网络的私密性,并且只允许我自己访问它,并阻止通过我的共享 wifi 连接的其他用户访问我的文件服务器。

答案2

我在 Windows 7 Pro 64 位笔记本电脑中使用以下脚本,同时使用有线和无线网卡以及单个默认网关,希望这会对您有所帮助。您可能需要对该脚本进行一些更改,因为我不知道您的 IP 和接口名称,而且我多次使用删除命令,因为我的接口 IP 需要删除(我不知道为什么)仍然不明白为什么我的接口需要手动删除 ips。

@echo off  
set wifi_name=Wireless Network Connection  
set wire_name=Local Area Connection  
set wire_ip=192.168.0.117  
set wire_mask=255.255.252.0  
set wire_gw=192.168.0.130  
set wifi_ip=192.168.2.170  
set wifi_mask=255.255.252.0  
set wifi_gw=192.168.0.130  
set wifi_ip2=192.168.105.117  
set wifi_mask2=255.255.255.0  
set wifi_gw2=192.168.105.130  
set dns1=4.2.2.1  
set dns2=4.2.2.2  
set dns3=8.8.8.8  
set dns4=4.2.2.3  
:multinetwork  
echo Configuring Both Wire and WiFi Networks cards for KHI HO Network  
echo.  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.0.117 gateway=all  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.2.170 gateway=all  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.105.117 gateway=all  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.0.117 gateway=all  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.2.170 gateway=all  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.105.117 gateway=all  
echo "Disabling Interfaces"  
::--------------------  
netsh int ip set address "%wire_name%" source = dhcp  
echo.  
netsh int ip set dns "%wire_name%" dhcp  
timeout /t 3 /nobreak  
netsh int ip set address "%wire_name%" source = dhcp  
echo.  
netsh int ip set dns "%wire_name%" dhcp  
::--------------------  
netsh int ip set address "%wifi_name%" source = dhcp  
echo.  
netsh int ip set dns "%wifi_name%" dhcp  
timeout /t 3 /nobreak  
netsh int ip set address "%wifi_name%" source = dhcp  
echo.  
netsh int ip set dns "%wifi_name%" dhcp  
echo.  
echo "Disabling Interfaces"  
netsh interface set interface name="%wifi_name%" admin=DISABLED  
echo.  
echo.  
netsh interface set interface name="%wire_name%" admin=DISABLED  
echo.  
timeout /t 7 /nobreak  
echo "Setting up DHCP on Interfaces"  
echo.  
netsh int ip set address "%wifi_name%" source = dhcp  
echo.  
netsh int ip set dns "%wifi_name%" dhcp  
echo.  
netsh int ip set address "%wire_name%" source = dhcp  
echo.  
netsh int ip set dns "%wire_name%" dhcp  
echo.  
timeout /t 5 /nobreak  
echo.  
netsh int ip set address "%wifi_name%" source = dhcp  
echo.  
netsh int ip set dns "%wifi_name%" dhcp  
echo.  
netsh int ip set address "%wire_name%" source = dhcp  
echo.  
netsh int ip set dns "%wire_name%" dhcp  
echo.  
timeout /t 7 /nobreak  
echo "Enabling Interfaces"  
echo.  
echo.  
netsh interface set interface name="%wire_name%" admin=ENABLED  
echo.  
timeout /t 5 /nobreak  
echo "Setting up DHCP on Interfaces"  
echo.  
echo.  
netsh int ip set address "%wire_name%" source = dhcp  
echo.  
netsh int ip set dns "%wire_name%" dhcp  
echo.  
timeout /t 3 /nobreak  

echo.  
echo "Setting Static IP Information"  
echo.  
echo Setting IP, MASK, and Gateway for WiFi Interface  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.0.117 gateway=all  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.105.117 gateway=all  
netsh interface ip set address name="%wire_name%" source=static addr=%wifi_ip2% mask=%wifi_mask2% gateway=%wifi_gw2%  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.0.117 gateway=all  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.2.170 gateway=all  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.105.117 gateway=all  
netsh interface ip set address name="%wire_name%" source=static addr=%wifi_ip2% mask=%wifi_mask2% gateway=%wifi_gw2%  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.2.170  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.0.117  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.105.117  
netsh interface ip set address "%wire_name%" static %wifi_ip2% %wifi_mask2%  

timeout /t 5 /nobreak  
echo Setting IP, MASK, and Gateway for Wire Interface  
netsh interface set interface name="%wifi_name%" admin=ENABLED  
timeout /t 5 /nobreak  
netsh int ip set address "%wifi_name%" source = dhcp  
echo.  
netsh int ip set dns "%wifi_name%" dhcp  
timeout /t 5 /nobreak  
netsh interface ip set address name="%wifi_name%" source=static addr=%wire_ip% mask=%wire_mask%  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.0.117 gateway=all  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.2.170 gateway=all  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.105.117 gateway=all  
netsh interface ip set address name="%wifi_name%" source=static addr=%wire_ip% mask=%wire_mask%  
timeout /t 5 /nobreak  
echo Setting Wire DNS Primary  
netsh interface ip set dns "%wire_name%" static %dns1%  
echo Setting DNS Secondary  
netsh interface ip add dns "%wire_name%" %dns2% index=2  
echo Setting 3rd DNS Secondary  
netsh interface ip add dns "%wire_name%" %dns3% index=3  
echo.  
echo Setting IP, MASK, and Gateway for WiFi Interface  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.2.170  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.0.117  
netsh interface ipv4 delete address "%wifi_name%" addr=192.168.105.117  
netsh interface ip set address name="%wifi_name%" source=static addr=%wifi_ip2% mask=%wifi_mask2% gateway=%wifi_gw2%  
timeout /t 5 /nobreak  
echo Setting IP, MASK, and Gateway for Wire Interface  
netsh interface ip set address name="%wire_name%" source=static addr=%wire_ip% mask=%wire_mask%  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.2.170  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.105.117  
netsh interface ipv4 delete address "%wire_name%" addr=192.168.0.117  
netsh interface ip set address name="%wire_name%" source=static addr=%wire_ip% mask=%wire_mask%  
echo Setting WiFi DNS Primary  
netsh interface ip set dns "%wifi_name%" static %dns1%  
echo Setting DNS Secondary  
netsh interface ip add dns "%wifi_name%" %dns2% index=2  
echo Setting 3rd DNS Secondary  
netsh interface ip add dns "%wifi_name%" %dns4% index=3  
echo.  
netsh interface ip set address name="%wire_name%" source=static addr=%wire_ip% mask=%wire_mask%  
echo Here are the new settings for %computername%:  
netsh int ip show config  
echo.  
::-------------------------  
:ping  
Set "newbox=start cmd /k"  
Set IPs=8.8.8.8  
For %%* in (%IPs%) do %newbox% ping.exe %%* -S %wifi_ip2% -t  
Set "newbox=start cmd /k"  
Set IPs=www.yahoo.com  
For %%* in (%IPs%) do %newbox% ping.exe %%* -S %wire_ip% -t  
::-----------------  
goto end

相关内容