I
I
i_goodwin2019-01-24 10:21:28
linux
i_goodwin, 2019-01-24 10:21:28

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

3 answer(s)
A
Artem @Jump, 2019-01-24
Tag

The question is how to identify the sign of "dullness" of the address
Yes, 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.
Therefore, it is defined elementarily.
Gray addresses start with -
10
100
127
169
172
192
All other addresses are white.
Most likely you are not looking at the address there.
The only place where you can see the address is the interface of the device that received the address.
And then some people manage to look up their address on resources like 2ip.ru ... Do not be like such people.

R
res2001, 2019-01-24
@res2001

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.

C
CityCat4, 2019-01-24
@CityCat4

if such an address can start with 77.xxx.xxx.xxx (same as white)

The range of gray addresses is very well known:
#       10.0.0.0        -   10.255.255.255
#       172.16.0.0      -   172.31.255.255
#       192.168.0.0     -   192.168.255.255

All.
All other addresses are white. The fact that something is not available at the same time is Rostelecom's tricks.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question