If you want to connect to internet using Wi-Fi and connect to the local network using LAN this is the way to do it in Windows.
Open the Command Prompt as administrator
Hit route print
or
netstat -r
Here is the current routing table of my PC when I connected to both Wi-Fi & LAN networks.
Best path to a destination will be chosen by 2 simple rules
Longest match will be preferred
If there are 2 routes to same destination & mask, lowest metric will be preferred
If you hit ipconfig you can get your gateway IPs. My Wi-Fi gateway is 192.168.37.190 & LAN gateway is 203.115.41.254.
Problem is that there are 2 routes pointed to 0.0.0.0 which is to internet and the lowest metric route is to go through the LAN interface which actually cannot reach internet.
Let's delete all routes to internet (default routes)
Complete command is route delete <destination> mask <mask> <gateway>
To delete all the routes to 0.0.0.0 through any gateway you can hit route delete 0.0.0.0
Let's add a route to internet with a metric of 5 to go through Wi-Fi gateway (192.168.37.190)
Metric of 5 is just a random number which is lower than any route in my routing table. You can give any other number which will suit your routing table.
Complete Command is;
route add <destination> mask <mask> <gateway> metric <metric> if <interface>
Interface is not necessary, It will be added automatically to match the gateway. It is just your IP on the regarding NIC.
Hit route -p add 0.0.0.0 mask 0.0.0.0 192.168.37.190 metric 5
Now let's add 3 more routes to private ip addresses with a metric of 5 to go through LAN gateway (203.115.41.254)
Hit the following commands
route add -p 10.0.0.0 mask 255.0.0.0 203.115.41.254 metric 5
route add -p 172.16.0.0 mask 255.240.0.0 203.115.41.254 metric 5
route add -p 192.168.0.0 mask 255.255.0.0 203.115.41.254 metric 5
Now you can hit route print again to see the Windows routing table. Task is completed..
Note:
To permanently add routes, use -p after route add commands. It will be stored in persistent routes area under the routing table of route print output.
Commands I entered?
route delete 0.0.0.0
route -p add 0.0.0.0 mask 0.0.0.0 192.168.37.190 metric 5
route -p add 10.0.0.0 mask 255.0.0.0 203.115.41.254 metric 5
route -p add 172.16.0.0 mask 255.240.0.0 203.115.41.254 metric 5
route -p add 192.168.0.0 mask 255.255.0.0 203.115.41.254 metric 5
WİNDOWS SERVIS HALINE GETIRME
sc create [Data Router EOIR] binpath= ["c:\Program Files (X86)\TAI\Data Router\DR-EO_IR\bin\datarouter.exe serv"] start= auto
Hiç yorum yok:
Yorum Gönder