How to use the same static IP address with different ISPs?

允我心安 提交于 2020-03-04 18:47:17

问题


I have a database server configured on AWS and I want to restrict access to it only from my computer's IP.

The problem is as IP addresses get assigned dynamically by the ISPs, I manually need to whitelist my IP address before accessing the server from my computer, everytime I switch from my home network to some other network.

I have been able to set a static IP address for my machine, but when I try to change my ISP from local broadband to mobile internet's hot-spot or to another network different from my broadband, the connection seems to fail. Is there any way to make my machine use the same static IP while using different ISPs ?


回答1:


Here's a script I use:

IP=`curl -s http://whatismyip.akamai.com/`
aws ec2 authorize-security-group-ingress --group-name GROUP-NAME --protocol tcp --port 22   --cidr $IP/32 --output text

In this example, it is adding my current IP address to the security group for use with SSH (port 22). You can modify it for your needs.

Please note that there is a maximum number of security group rules, so you will need to "empty it out" after you've hit the limit.



来源:https://stackoverflow.com/questions/60399574/how-to-use-the-same-static-ip-address-with-different-isps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!