Scrip cập nhật IP động qua cloudfalre Làm webserver tại nhà với Raspberry Pi.

quynhlamhuynh

New member
** Sử dụng tập lệnh này để cập nhật IP động qua CloudFlare khi sử dụng Raspberry Pi làm máy chủ web Home. **

Raspberry Pi là một thiết bị đa năng có thể được sử dụng cho nhiều mục đích khác nhau.Một trong những cách sử dụng phổ biến nhất cho Raspberry Pi là tạo một máy chủ web.Đây là một cách tuyệt vời để lưu trữ một trang web nhỏ, blog cá nhân hoặc trang web công ty không yêu cầu nhiều lưu lượng truy cập.

Tuy nhiên, một nhược điểm của việc sử dụng Raspberry Pi làm máy chủ web là địa chỉ IP là động.Điều này có nghĩa là nó sẽ thay đổi mỗi khi modem được đặt lại.Đây có thể là một vấn đề nếu bạn muốn giữ cho trang web của bạn có thể truy cập từ thế giới bên ngoài.

Để giải quyết vấn đề này, bạn có thể sử dụng tập lệnh để cập nhật địa chỉ IP động của mình với CloudFlare.Tập lệnh này sẽ tự động cập nhật địa chỉ IP của bạn bất cứ khi nào thay đổi, vì vậy trang web của bạn sẽ luôn có thể truy cập được.

Để sử dụng tập lệnh này, chỉ cần tải xuống từ liên kết sau:

[https:

Khi bạn đã tải xuống tập lệnh, bạn cần chỉnh sửa nó và nhập thông tin CloudFlare của bạn.

Tiếp theo, bạn cần tạo một công việc crontab để chạy kịch bản cứ sau vài phút.Điều này sẽ đảm bảo rằng địa chỉ IP của bạn luôn được cập nhật.

Dưới đây là một ví dụ về một công việc crontab mà bạn có thể sử dụng:

`` `
* * * * *//path/to/updateip.sh
`` `

Công việc này sẽ chạy kịch bản mỗi phút.

Bây giờ, bất cứ khi nào modem của bạn được đặt lại, địa chỉ IP của bạn sẽ tự động được cập nhật với CloudFlare.Điều này có nghĩa là trang web của bạn sẽ luôn có thể truy cập từ thế giới bên ngoài.

Ngoài Raspberry Pi, tập lệnh này cũng có thể được sử dụng trên bất kỳ máy chủ Linux nào khác.Điều này bao gồm các thiết bị như Orange Pi và Mini PC X86.
=======================================
**Use this script to update dynamic IP via CloudFlare when using Raspberry Pi as a home web server.**

Raspberry Pi is a versatile device that can be used for many different purposes. One of the most popular uses for Raspberry Pi is to create a web server. This is a great way to host a small website, personal blog, or company website that doesn't require a lot of traffic.

However, one downside to using Raspberry Pi as a web server is that the IP address is dynamic. This means that it will change every time the modem is reset. This can be a problem if you want to keep your website accessible from the outside world.

To solve this problem, you can use a script to update your dynamic IP address with CloudFlare. This script will automatically update your IP address whenever it changes, so your website will always be accessible.

To use this script, simply download it from the following link:

[https://github.com/giangpt12/updateip.git](https://github.com/giangpt12/updateip.git)

Once you have downloaded the script, you need to edit it and enter your CloudFlare information.

Next, you need to create a Crontab job to run the script every few minutes. This will ensure that your IP address is always up-to-date.

Here is an example of a Crontab job that you can use:

```
* * * * * /path/to/updateip.sh
```

This job will run the script every minute.

Now, whenever your modem is reset, your IP address will automatically be updated with CloudFlare. This means that your website will always be accessible from the outside world.

In addition to Raspberry Pi, this script can also be used on any other Linux server. This includes devices such as Orange Pi and Mini PC X86.
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top