IP restricted plugins
IP restriction plug-in, is a very simple plug-in, you can set blacklist IP, whitelist IP This is very simple.
Rules:
IP black and white lists, support single, multiple, range points Segment IP (satisfies the CIDR notation rule). Separate multiple IPs with a comma ,.
CIDR notationThe specifications are as follows:
10.10.10.0/24 < /span>means that 10.10.10.* cannot be accessed.
About CIDR notation Rules are beyond the scope of this article, please refer to it yourselfhttps://zh.wikipedia.org/wiki/%E6%97%A0%E7%B1%BB%E5%88% AB%E5%9F%9F%E9%97%B4%E8%B7%AF%E7%94%B1
1.Set up a blacklist< span class="s1">IP
Here, I will blacklist my own IP< span class="s1">.
The access results are as follows:
{
“message”: “Your IP address is not allowed”< /p>
}
2.< /span>Set up a whitelist
Here is an interesting experiment. If I also set my IP as a whitelist, and Set to blacklist.
So, will the blacklist take effect? Is it a whitelist?
Let’s try it out:
Visit the interface again, and the result is returned correctly:
{
“status”: “UP”,
“diskSpace”: {
“status” : “UP”,
“total”: 19992150016,
” free”: 15094071296,
“threshold”: 10485760
},
“redis”: {
“status”: “UP” ,
“version”: “3.2.5”
},
“db”: {
“status”: “UP” ,
“database”: “MySQL”,
“hello”: 1
},
“configServer”: {
“status”: “UP”,
“propertySources”: [
“file:/opt/configServer/configs/application.yml#dev”,
“file:/opt/configServer/configs/application.yml”
]
< p class="p4"> }
}
From this, we can conclude that if consumer’sip, at the same time match IP in the black and white list, then the white list will take priority. In fact, if you set both a whitelist and a blacklist at the same timeIPis inconsistent, the system will prompt youyou cannot set both a whitelist and a blacklist !
span>