Answer the question
In order to leave comments, you need to log in
How to write a program to determine the gray address?
Good afternoon!
I have an Internet connection via Rostelecom via an [email protected] 1744 v4 router with standard firmware from the provider, a server based on Ubuntu Server. The problem is that from time to time (about once a week) the router receives a gray ip-address. Services on the server, respectively, become inaccessible from the outside. After the n-th number of forced disconnects, a white ip-address is assigned again, all services on the server become available again.
Due to the fact that the provider does not allow you to connect the "Static ip-address" service, I want to write a program that, when receiving a gray ip-address, sends the router to reboot until it receives a white one. The question is how to identify the sign of the "dullness" of the address, if such an address can begin with 77.xxx.xxx.xxx (just like the white one).
Answer the question
In order to leave comments, you need to log in
The question is how to identify the sign of "dullness" of the addressYes, elementary - if your services are available, then white, otherwise gray.
if such an address can start with 77.xxx.xxx.xxx (same as white).Can not. Of course, it is not theoretically possible to shove a white address behind NAT, but no one in their right mind will do this.
An address starting with 77 is white. The list of gray addresses is fixed, officially documented in the RFC and not a secret at all. Follow the link to see the addresses in the table in clause 3 marked "Private-Use Networks".
You can only see the real issued address on the router. if the router receives a gray address, then in order to access the Internet, traffic must go through the provider's NAT, where the address is substituted and on the Internet you already have a white address anyway.
Usually routers support not only web management, but also SSH and possibly telnet. Using them, you can get the address with a script, check it, and if it is gray, then reboot the router with another script (or even not reboot, but reset the connection and install again). The same can be done through the web interface, but creating your own HTTP requests and parsing the router's HTTP responses is a more tedious task than the ssh/telnet option.
if such an address can start with 77.xxx.xxx.xxx (same as white)
# 10.0.0.0 - 10.255.255.255
# 172.16.0.0 - 172.31.255.255
# 192.168.0.0 - 192.168.255.255
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question