ipv4

Convert IPv4 to IPv6 manually

风格不统一 提交于 2019-12-20 04:39:05
问题 After read this article i have a question: In the exapmle in this link there is explanation hot to convert 192.168.25.234 into equivalent IPv6 address so in the example this address become C0A8:19EA and it says that this can be written into the following 128-Bit IPv6 link-local address: FE80:0000:0000:0000:0000:0000:C0A8:19EA or FE80::C0A8:19EA So my question is how C0A8:19EA become FE80:0000:0000:0000:0000:0000:C0A8:19EA ? 回答1: The C0, A8, 19 and EA are just 192, 168, 25 and 234 displayed in

is ipv6 backward compatible with ipv4?

此生再无相见时 提交于 2019-12-20 04:09:54
问题 I've got a little udp example program written using ipv4. If I alter the code to ipv6 would I still be able to communicate with anyone using the listener with an ipv4 address? I was looking at porting examples at http://ou800doc.caldera.com/en/SDK_netapi/sockC.PortIPv4appIPv6.html I'm not sure if simply altering the code would ensure that it worked or if I'd have to write it in duel-stack mode. 回答1: Yes and no... IPv6 does contain completely different addressing, so you'll have to recode your

How show IPv4 only with REMOTE_ADDR in PHP?

南楼画角 提交于 2019-12-20 01:41:44
问题 I have a question with variable : $_SERVER['REMOTE_ADDR'] . I wish he recovers ONLY IP addresses in IPv4 format . It extracted me a few times in IPv6 format . How to do? 回答1: $_SERVER['REMOTE_ADDR'] always contains the address of the visitor. If it contains an IPv6 address then the visitor used IPv6 and there is no IPv4 address. And vice versa of course. These days you have to be able to deal with both. Some visitors will have only IPv4, some will have only IPv6 and some will have both. The

Python urllib2 force IPv4

别说谁变了你拦得住时间么 提交于 2019-12-19 19:45:00
问题 I am running a script using python that uses urllib2 to grab data from a weather api and display it on screen. I have had the problem that when I query the server, I get a "no address associated with hostname" error. I can view the output of the api with a web browser, and I can download the file with wget, but I have to force IPv4 to get it to work. Is it possible to force IPv4 in urllib2 when using urllib2.urlopen? 回答1: Not directly, no. So, what can you do? One possibility is to explicitly

Python urllib2 force IPv4

岁酱吖の 提交于 2019-12-19 19:44:08
问题 I am running a script using python that uses urllib2 to grab data from a weather api and display it on screen. I have had the problem that when I query the server, I get a "no address associated with hostname" error. I can view the output of the api with a web browser, and I can download the file with wget, but I have to force IPv4 to get it to work. Is it possible to force IPv4 in urllib2 when using urllib2.urlopen? 回答1: Not directly, no. So, what can you do? One possibility is to explicitly

首页连接超时问题解决方法

不羁的心 提交于 2019-12-19 19:02:06
今早发现新增首页节点报错,无法连接,部分节点发现问题,说明服务问题可能性不大,于是想到是内核参数的问题。果然由于是新增的节点,没有对系统优化导致。现在是发现问题过程记录一下: 1、查看连接状态,汇总一下 netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' CLOSE_WAIT 42 ESTABLISHED 0 TIME_WAIT 1006 2、先优化内核参数 vi /etc/sysctl.conf net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse=1 #让TIME_WAIT状态可以重用,这样即使TIME_WAIT占满了所有端口,也不会拒绝新的请求造成障碍 默认是0 net.ipv4.tcp_tw_recycle=1 #让TIME_WAIT尽快回收 默认0 net.ipv4.tcp_fin_timeout=30 /sbin/sysctl -p #让参数生效 3、重启相关java服务 虽然这是运维发现问题的常识,但因为环境变化,可能会忘记,这里记录一下。 来源: 51CTO 作者: pointsand 链接: https://blog.51cto.com/dadloveu/2459902

CentOS7的内核优化

夙愿已清 提交于 2019-12-19 12:55:01
修改内核配置文件 vim /etc/sysctl.conf 刷新配置文件 sysctl -p 关ipv6 net.ipv6.conf.all.disable_ipv6 = 1 net.ipv6.conf.default.disable_ipv6 = 1 避免放大攻击 net.ipv4.icmp_echo_ignore_broadcasts = 1 开启恶意的icmp错误消息保护 net.ipv4.icmp_ignore_bogus_error_responses = 1 关闭路由转发 net.ipv4.ip_forward = 0 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 开启反向路径过滤 net.ipv4.conf.all.rp_filter = 1 net.ipv4.conf.default.rp_filter = 1 处理无源路由的包 net.ipv4.conf.all.accept_source_route = 0 net.ipv4.conf.default.accept_source_route = 0 关sysrq功能 kernel.sysrq = 0 core文件名添加pid作为扩展名 kernel.core_uses_pid = 1 开SYN洪水攻击保护

首页连接超时问题解决方法

為{幸葍}努か 提交于 2019-12-19 12:24:12
今早发现新增首页节点报错,无法连接,部分节点发现问题,说明服务问题可能性不大,于是想到是内核参数的问题。果然由于是新增的节点,没有对系统优化导致。现在是发现问题过程记录一下: 1、查看连接状态,汇总一下 netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}' CLOSE_WAIT 42 ESTABLISHED 0 TIME_WAIT 1006 2、先优化内核参数 vi /etc/sysctl.conf net.ipv4.tcp_syncookies = 1 net.ipv4.tcp_tw_reuse=1 #让TIME_WAIT状态可以重用,这样即使TIME_WAIT占满了所有端口,也不会拒绝新的请求造成障碍 默认是0 net.ipv4.tcp_tw_recycle=1 #让TIME_WAIT尽快回收 默认0 net.ipv4.tcp_fin_timeout=30 /sbin/sysctl -p #让参数生效 3、重启相关java服务 虽然这是运维发现问题的常识,但因为环境变化,可能会忘记,这里记录一下。 来源: 51CTO 作者: pointsand 链接: https://blog.51cto.com/dadloveu/2459901

How can you run iOS Apps on the Google Cloud even though it lacks support for IPv6

喜你入骨 提交于 2019-12-19 09:01:53
问题 A new app store policy by Apple has taken effect on June 1 so that all apps submitted to the App Store must support IPv6-only networking (https://developer.apple.com/news/?id=05042016a). How is it possible to host an app on Google Cloud Platform that only supports IPv4 (https://cloud.google.com/compute/docs/networking) and still passes Apple's review process? 回答1: The server side of the app doesn't need to be reachable over IPv6 yet. Most IPv6-only networks have a DNS64/NAT64 service to reach

Python - parse IPv4 addresses from string (even when censored)

a 夏天 提交于 2019-12-19 08:14:35
问题 Objective: Write Python 2.7 code to extract IPv4 addresses from string. String content example: The following are IP addresses: 192.168.1.1, 8.8.8.8, 101.099.098.000. These can also appear as 192.168.1[.]1 or 192.168.1(.)1 or 192.168.1[dot]1 or 192.168.1(dot)1 or 192 .168 .1 .1 or 192. 168. 1. 1. and these censorship methods could apply to any of the dots (Ex: 192[.]168[.]1[.]1). As you can see from the above, I am struggling to find a way to parse through a txt file that may contain IPs