VPN simultaneously accesses the Internet (batch processing, Automatically Obtaining IP addresses and changing routes)
The computer in the house is too bad, and the virtual machine cannot be activated. You can only use a VPN to connect to the VPN Server of the organization, and open the Virtual Machine on another working machine. After the dial-up VPN connection is successful, it will be slow to open the web page. Next, you can use batch processing to automatically add routes to access the company's network resources through the VPN, and browse the Web page online through your own network. How to Create a VPN is not detailed here, after being directly created in the Network Center, go to properties-Network-TCP/IP4 properties-advanced-and deselect the "use default gateway on remote network" check box. Assume that our VPN name is PvButler, after connecting to the VPN, run the following batch processing. The route address added in the batch can be modified according to your own requirements.
@ Echo offREM set the network adapter name set "AdapterName = PvButler" set "FileTmp = % temp % \ ipList.txt" ipconfig/all> "% FileTmp %" for/f "delims =: "% I in ('findstr/n/c:" % AdapterName % "" % FileTmp % "') do (set" SkipRow = % I "goto: DoSkip ): doSkipfor/f "tokens = 2 delims = :(" % I in ('more + % SkipRow % "% FileTmp %" ^ | findstr/v "IPv6" ^ | findstr "IP "') do (set "IP = % I" goto: ShowResult): ShowResultset "IP = % IP: = %" echo, % IP % route add 10.10.0.0 mask route 255.0.0% IP % route add 10.17.0.0 mask route 255.0.0% IP % route add 10.15.0.0 mask route 255.0.0% IP % route add 192.168.0.0 mask route 255.0.0% IP % ping 10.15.44.254-n 2 pause
Because the IP address is changed after each VPN dial (for example, 10.0.0.5, the IP address will change to 10.0.0.2 after each VPN dial), do not add the parameter-p when adding a route