phuocthinhdl
Senior Member
https://serverfault.com/questions/9...-thru-different-network-interfaces-in-windows
Theo như case này thì giống y mình: tức là có 1 lan nội bộ và 1 usb bắt wifi.
Tuy nhiên cũng vẫn chưa tiện lợi. Mình theo dõi link trên thì đại ý là cũng route add để chỉ định các trang cụ thể sẽ phải đi qua cái gateway cụ thể (mỗi card mạng có 1 cái gateway).
Như vậy theo lý thuyết thì mọi truy vấn đc ưu tiên cho qua usb wifi. Nên mình chỉ cần route add mỗi cái dãy IP nội bộ nữa là xong.
Mình còn cẩn thận bật cái dịch vụ routing and remote access, nhưng mà nó bật lên xong thì tự động bị stop lại. Không hiểu bị gì.
Kết quả cuối cùng thì vẫn không được. Khi enable cả 2 cái card mạng lên thì mặc định máy vẫn ưu tiên mỗi cổng Lan.
Mình nghi là do cái dịch vụ trên kia bị sao rồi. Chờ cao nhân nào bắt bệnh giúp
Theo như case này thì giống y mình: tức là có 1 lan nội bộ và 1 usb bắt wifi.
- Các trang và app nội bộ chỉ có thể truy cập qua lan.
- muốn lướt internet thì mình phải disconect cái lan để mỗi wifi.
Tuy nhiên cũng vẫn chưa tiện lợi. Mình theo dõi link trên thì đại ý là cũng route add để chỉ định các trang cụ thể sẽ phải đi qua cái gateway cụ thể (mỗi card mạng có 1 cái gateway).
- Ở đây mình set cho các IP thuộc dãy 10.x.y.z đi sang card lan - gateway 10.x.y.30
- Còn các ip khác đi sang cái usb wifi.
Như vậy theo lý thuyết thì mọi truy vấn đc ưu tiên cho qua usb wifi. Nên mình chỉ cần route add mỗi cái dãy IP nội bộ nữa là xong.
Mình còn cẩn thận bật cái dịch vụ routing and remote access, nhưng mà nó bật lên xong thì tự động bị stop lại. Không hiểu bị gì.
Kết quả cuối cùng thì vẫn không được. Khi enable cả 2 cái card mạng lên thì mặc định máy vẫn ưu tiên mỗi cổng Lan.
Mình nghi là do cái dịch vụ trên kia bị sao rồi. Chờ cao nhân nào bắt bệnh giúp
Bash:
'***********************
'Name: Toggle Connection
'Author: Jeremy England
'Company: SimplyCoded
'Date: 10/01/2016
'***********************
Option Explicit
Dim interface, interfaceName, interfaceTarget, available, verb
Dim objShell, RegLocate, RegLocate1
Set objShell = WScript.CreateObject("WScript.Shell")
On Error Resume Next
'Pick the Interface Name you want to disable/enable
interfaceName = "Ethernet"
'Find available Names by running this script or in cmd
'>> netsh interface show interface [enter]
'Set up required objects
Dim objApp : Set objApp = CreateObject("Shell.Application")
Dim objFolder : Set objFolder = objApp.Namespace(&H31&).Self.GetFolder
'Check if Network Connections folder exists
If objFolder Is Nothing Then
MsgBox "Network Connections folder not found. Check the location: ""C:\Windows\System32\ncpa.cpl""", vbCritical
WScript.Quit
End If
'Make sure interface exists
Set interfaceTarget = Nothing
'Interface exists
For Each interface In objFolder.Items
If LCase(interface.Name) = LCase(interfaceName) Then
Set interfaceTarget = interface
End If
available = available & interface.Name & vbLf
Next
'Interface Doesn't exist
If interfaceTarget Is Nothing Then
MsgBox "Interface Name: """ & interfaceName & """ not found. " &_
"Available Interface Names: " & vbLf & vbLf & available, vbCritical
WScript.Quit
End If
'Interface Enable / Disable
For Each verb In interfaceTarget.Verbs
If verb.Name = "En&able" Then
verb.DoIt
WScript.Sleep 1000
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"
objShell.RegWrite RegLocate,"http://proxy.xnxx.com.vn:5101","REG_SZ"
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
objShell.RegWrite RegLocate,"1","REG_DWORD"
MsgBox "Enabled: """ & interfaceName & """", vbInformation
ElseIf verb.Name = "Disa&ble" Then
verb.DoIt
WScript.Sleep 1000
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer"
objShell.RegWrite RegLocate,"0.0.0.0:80","REG_SZ"
RegLocate = "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyEnable"
objShell.RegWrite RegLocate,"0","REG_DWORD"
MsgBox "Disabled: """ & interfaceName & """", vbInformation
End If
Next
Last edited: