VPN simultaneously accesses the Internet (batch processing, Automatically Obtaining IP addresses and changing routes)

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.