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

The method of implementing DDNS dynamic Domain name Resolution Service in LINUX

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

Share

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

Linux systems can write script commands to resolve dynamic domain names, and support dynamic domain name resolution for IPV4 and IPV6.

Go directly to the code:

Go to IPV4 first.

Sync

Old=$ (cat ip.asp)

Sleep 10

New=$ (ifconfig vlan2 | awk'/ inet/')

If ["$old"! = "$new"]

Then

Rm-rf ip.asp

Echo $new > ip.asp

Wget "http://main.meibu.com/ip/login.asp?name=abc.meibu.net&pwd=abc"

Rm login.asp*

Else

Echo "= = same!"

Fi

The variable new here is the new IP address new=$ (ifconfig vlan2 | awk'/ inet/'), which can get the native IP.

Compared with the last comparison, if the same is the same, the difference will be submitted to the parsing server, and the IP will be written to the file ip.asp for the next comparison.

And then on IPV6.

Sync

Old=$ (cat ips6.asp)

Sleep 10

New=$ (ifconfig vlan2 | awk'/ inet6/')

If ["$old"! = "$new"]

Then

Rm-rf ips6.asp

Echo $new > ips6.asp

Wget "http://v6.meibu.com/v6.asp?name=abc.noip.cn&pwd=abc"

Rm v6.asp*

Else

Echo "= = same!"

Fi

The variable new here is the new IPV6 address new=$ (ifconfig vlan2 | awk'/ inet6/'). You can get the native IPV6 address. If it is the same as the last comparison, it will end if it is different, and submit it to the parsing server. At the same time, write the IPV6 to the file ips6.asp for next comparison.

The abc.noip.cn&pwd=abc is changed to the domain name and password you applied for at each step.

Just make a timer or loop.

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