ARP bidirectional Batch Processing

Source: Internet
Author: User
This batch is automatically set to the MAC of the local Nic and the MAC of the gateway. It runs automatically at each startup.

Batch Processing is automatically obtained!

Code:
@ Echo off

If % ~ N0 = ARP exit

If % ~ N0 = ARP exit

If % ~ N0 = ARP exit

ECHO is obtaining local information .....

: IP

For/F "Skip = 13 tokens = 15 usebackq" % I in ('ipconfig/all') do set IP = % I & goto Mac

: Mac

Echo IP: % IP %

For/F "Skip = 13 tokens = 12 usebackq" % I in ('ipconfig/all') do set MAC = % I & goto custom IP

: Elastic IP

Echo Mac: % Mac %

ARP-d

ARP-S % IP % Mac %

ECHO is obtaining gateway information .....

For/F "Skip = 17 tokens = 13 usebackq" % I in ('ipconfig/all') do set multicast IP = % I & goto encrypt Mac

: Running Mac

Echo IP: % gateip %

Ping % gateip %

For/F "Skip = 3 tokens = 2 usebackq" % I in ('Arp-A % Taobao IP % ') do set hosts MAC = % I & goto start

: Start

Echo Mac: % running Mac %

ARP-S % gateip % gatemac %

Echo operation completed !!!

Exit
*****************************
@ Echo off

If % ~ N0 = ARP exit

If % ~ N0 = ARP exit

If % ~ N0 = ARP exit

ECHO is obtaining local information .....

: IP

For/F "Skip = 13 tokens = 15 usebackq" % I in ('ipconfig/all') do set IP = % I & goto Mac

: Mac

Echo IP: % IP %

For/F "Skip = 13 tokens = 12 usebackq" % I in ('ipconfig/all') do set MAC = % I & goto custom IP

: Elastic IP

Echo Mac: % Mac %

ARP-S % IP % Mac %

Set destination IP = Route IP

: Running Mac

Echo IP: % gateip %

For/F "Skip = 3 tokens = 2 usebackq" % I in ('Arp-A % Taobao IP % ') do set hosts MAC = % I & goto start

: Start

Echo Mac: % running Mac %

ARP-d

ARP-S % gateip % gatemac %

Echo operation completed !!!

Exit

*********************
@ Echo off

If % ~ N0 = ARP exit

If % ~ N0 = ARP exit

If % ~ N0 = ARP exit

ECHO is obtaining local information .....

: IP

For/F "Skip = 13 tokens = 15 usebackq" % I in ('ipconfig/all') do set IP = % I & goto Mac

: Mac

Echo IP: % IP %

For/F "Skip = 13 tokens = 12 usebackq" % I in ('ipconfig/all') do set MAC = % I & goto custom IP

: Elastic IP

Echo Mac: % Mac %

ARP-S % IP % Mac %

Set destination IP = Route IP

Set ingress MAC = route Mac

ARP-d

ARP-S % gateip % gatemac %

Echo operation completed !!!

Exit

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.