Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize batch processing of boot binding IP and MAC and gateway IP and MAC address

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to bind IP and MAC and the batch processing of gateway IP and MAC address. This article is very detailed and has certain reference value. Interested friends must read it!

Batch scripts that automatically bind native ip and mac and gateway ip and mac. Save the following script as txt, and then change the file suffix to bat

@ echo off

Read native Mac address

If exist ipconfig.txt del ipconfig.txt

Ipconfig / all > ipconfig.txt

If exist phyaddr.txt del phyaddr.txt

Find "Physical Address" ipconfig.txt > phyaddr.txt

For / f "skip=2 tokens=12"% M in (phyaddr.txt) do set Mac=%%M

Read native ip address

If exist IPAddr.txt del IPaddr.txt

Find "IP Address" ipconfig.txt > IPAddr.txt

For / f "skip=2 tokens=15"% I in (IPAddr.txt) do set IP=%%I

Bind native IP address and MAC address

Arp-s% IP%% Mac%

Read gateway address

If exist GateIP.txt del GateIP.txt

Find "Default Gateway" ipconfig.txt > GateIP.txt

For / f "skip=2 tokens=13" G in (GateIP.txt) do set GateIP=%%G

Read gateway Mac address

If exist GateMac.txt del GateMac.txt

Arp-a% GateIP% > GateMac.txt

For / f "skip=3 tokens=2"% H in (GateMac.txt) do set GateMac=%%H

Bind gateways Mac and IP

Arp-s% GateIP%% GateMac%

Del GateIP.TXT / Q

DEL GateMac.txt / q

Del IPAddr.txt / q

Del ipconfig.txt / q

Del phyaddr.txt / q

Exit

Just put this file in your startup or load it in the scheduled task.

The above is all the contents of the article "how to bind IP and MAC and the batch processing of gateway IP and MAC address". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report