ip

Exlusive client affinity

扶醉桌前 提交于 2020-01-25 02:18:30
问题 I am aware that client affinity is possible for a LoadBalancer type service in Kubernetes. The thing is that this affinity doesn't forbid that two different clientes access the same pod. Is it possible to associate a pod exclusively always to the same client? Thanks in advance and have a really nice day! 回答1: To only allow a specific external client/s to access a specific Pod/Deployment you can use whitelisting/source ranges. Restrictions can be applied to LoadBalancers as

Efficiently Banning IPs Using php and mysql?

人走茶凉 提交于 2020-01-24 20:37:10
问题 CREATE TABLE `banned_ip` ( `id` INT( 25 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , `ip` VARCHAR( 25 ) NOT NULL , `reason` TEXT NOT NULL ) Config.php <?php // config $config['host'] = "localhost"; // host name of your mysql server $config['user'] = "username"; // your mysql username $config['pass'] = "password"; // your mysql password $config['db'] = "database"; // the database your table is in. // the @ sign is an error supressor, meaning we can use our own error messages, this connects and

Regex grep external IP brings back internal IP as well - why?

|▌冷眼眸甩不掉的悲伤 提交于 2020-01-24 17:45:56
问题 I have this grep operation here that gives you the external IP from the output of ifconfig : ipa=$(ifconfig | grep -Po "inet addr:\K[^\s]+" | grep -v "^127") I desire to use only one grep , so I tried the following, which was partly successful: ipa=$(ifconfig | grep -Po "inet addr:\K[0-9]{1,3}?\.[0-9]{1,3}?\.[0-9]{1,3}?\.[0-9]{1,3}?") It is partly successful because it also brings a space plus the internal IP , for some reason: MY_IP_ADDRESS 127.0.0.1 Why is this happening? I mean, why are

Regex grep external IP brings back internal IP as well - why?

霸气de小男生 提交于 2020-01-24 17:45:40
问题 I have this grep operation here that gives you the external IP from the output of ifconfig : ipa=$(ifconfig | grep -Po "inet addr:\K[^\s]+" | grep -v "^127") I desire to use only one grep , so I tried the following, which was partly successful: ipa=$(ifconfig | grep -Po "inet addr:\K[0-9]{1,3}?\.[0-9]{1,3}?\.[0-9]{1,3}?\.[0-9]{1,3}?") It is partly successful because it also brings a space plus the internal IP , for some reason: MY_IP_ADDRESS 127.0.0.1 Why is this happening? I mean, why are

How to change the IP address of a docker after creating it?

天涯浪子 提交于 2020-01-24 13:12:32
问题 I have a docker linked to a bridge with IP address 192.168.150.1/24 . Once I create the docker instance from a docker image it gets an IP address, 192.168.150.2 , but according to my requirement, this IP address, 192.168.150.2 , must be reserved since I want to use it for some other thing. Now, I want to change the IP address of this docker instance as 192.168.150.3 . Is it possible to do? if so how? Please, help. 回答1: You will have to first detach the container from the custom network and

How to programmatically get a public IP address?

和自甴很熟 提交于 2020-01-24 10:02:25
问题 I didn't find the right solution. The below code gives me local IP address (if I connected to Wifi, it gives IP address like 192.168.0.x), but I want public IP address (same as if I search in google " what is my IP ") public static String getLocalIpAddress() { try { for (Enumeration<NetworkInterface> en = NetworkInterface.getNetworkInterfaces(); en.hasMoreElements();) { NetworkInterface intf = en.nextElement(); for (Enumeration<InetAddress> enumIpAddr = intf.getInetAddresses(); enumIpAddr

Dividing a given network in 4 subnets

╄→尐↘猪︶ㄣ 提交于 2020-01-24 02:13:07
问题 Lets suppose I get given the network (57.70.32.0/21) and I need to divide it into 4 equally sized networks. I know the mask at the moment is (255.255.248.0) but would I need to change the prefix length of the network given to 26 so I can get the 4 equal size subnets? Basically that's my biggest question and also if I should then use the 4th octet for subnetting or stay with the 3rd to do it. Any help would be extremely appreciated. 回答1: you can divide your ips into 4 networks with 510 IPs

How to calculate netmask from 2 ip adresses in Python

落花浮王杯 提交于 2020-01-23 18:16:27
问题 How can I calculate the subnetmask in Python if I have the first and the last ip adresses in a range? I want the netmask as e.g. 255.255.255.0. Thanks ;) 回答1: Say that we have... def ip_to_int(a, b, c, d): return (a << 24) + (b << 16) + (c << 8) + d Then you can have the representation doing a few XORs. Eg. >>> bin(0xFFFFFFFF ^ ip_to_int(192, 168, 1, 1) ^ ip_to_int(192, 168, 1, 254)) '0b11111111111111111111111100000000' So: def mask(ip1, ip2): "ip1 and ip2 are lists of 4 integers 0-255 each"

How to calculate netmask from 2 ip adresses in Python

孤人 提交于 2020-01-23 18:16:22
问题 How can I calculate the subnetmask in Python if I have the first and the last ip adresses in a range? I want the netmask as e.g. 255.255.255.0. Thanks ;) 回答1: Say that we have... def ip_to_int(a, b, c, d): return (a << 24) + (b << 16) + (c << 8) + d Then you can have the representation doing a few XORs. Eg. >>> bin(0xFFFFFFFF ^ ip_to_int(192, 168, 1, 1) ^ ip_to_int(192, 168, 1, 254)) '0b11111111111111111111111100000000' So: def mask(ip1, ip2): "ip1 and ip2 are lists of 4 integers 0-255 each"

Re-assign private IP address in AWS?

一世执手 提交于 2020-01-22 13:26:09
问题 I have an AWS instance running behind an elastic IP. The instance also has a private IP address in my VPC. I will be re-assigning the elastic IP to another instance and am trying to re-assign the private IP as well. Note that the instance only has one private IP (no secondary). Is this possible? 回答1: Unless this is a 'secondary private ip address' (and you said it was not), then no, you can't: You can assign additional private IP addresses, known as secondary private IP addresses, to