ipv4

Java library to check if IPv4 or IPv6 address is in a given subnet

浪子不回头ぞ 提交于 2019-12-01 03:22:11
What library can I use to check if an IP address is in a given subnet? I could find libraries like the Apache Commons SubnetUtils ( SubnetUtils.SubnetInfo.isInRange ) but many do not support IPv6 yet. edazdarevic's CIDRUtils supports both IPv4 and IPv6. The example does not mention boolean isInRange(String ipAddress), but it is implemented! Another option is java-ipv6 , but it does not support IPv4 and requires JDK7 . Use spring-security-web 's IpAddressMatcher . Unlike Apache Commons Net, it supports both ipv4 and ipv6. import org.springframework.security.web.util.matcher.IpAddressMatcher; ..

linux系统参数调优

我的未来我决定 提交于 2019-12-01 00:03:05
linux系统调优包括两个文件,一个是limits.conf文件,一个是sysctl.conf文件,这两个文件分别在/etc/secriuty/limits.conf和/etc/sysctl.conf下,具体修改内容如下: vi /etc/security/limits.conf * soft nproc 11000 #限制最多打开的软件数 * hard nproc 11000 #限制打开软件的最多进程数 * soft nofile 655350#限制最多打开的文件数 * hard nofile 655350#限制最多运行的进程数,一般设置为65535 #优化TCP vi /etc/sysctl.conf #禁用包过滤功能 net.ipv4.ip_forward = 0 #启用源路由核查功能 net.ipv4.conf.default.rp_filter = 1 #禁用所有IP源路由 net.ipv4.conf.default.accept_source_route = 0 #使用sysrq组合键是了解系统目前运行情况,为安全起见设为0关闭 kernel.sysrq = 0 #控制core文件的文件名是否添加pid作为扩展 kernel.core_uses_pid = 1 #开启SYN Cookies,当出现SYN等待队列溢出时,启用cookies来处理 net.ipv4.tcp

Java library to check if IPv4 or IPv6 address is in a given subnet

谁都会走 提交于 2019-11-30 23:32:33
问题 What library can I use to check if an IP address is in a given subnet? I could find libraries like the Apache Commons SubnetUtils (SubnetUtils.SubnetInfo.isInRange) but many do not support IPv6 yet. 回答1: edazdarevic's CIDRUtils supports both IPv4 and IPv6. The example does not mention boolean isInRange(String ipAddress), but it is implemented! Another option is java-ipv6, but it does not support IPv4 and requires JDK7. 回答2: Use spring-security-web 's IpAddressMatcher. Unlike Apache Commons

CentOS 6 系统优化 Shell 脚本

99封情书 提交于 2019-11-30 23:06:03
CentOS 已经发布了6.2版了,现在已经可以用在生产环境了,新版本的内核也能更好的利用硬件。写了一个 脚本 ,用来初始化系统环境,现在分享出来,你可以根据自己的需要,对脚本进行相应的修改。 脚本的内容如下: #!/bin/bash #author suzezhi #this script is only for CentOS 6 #check the OS platform=`uname -i` if [ $platform != "x86_64" ];then echo "this script is only for 64bit Operating System !" exit 1 fi echo "the platform is ok" version=`lsb_release -r |awk '{print substr($2,1,1)}'` if [ $version != 6 ];then echo "this script is only for CentOS 6 !" exit 1 fi cat << EOF +---------------------------------------+ | your system is CentOS 6 x86_64 | | start optimizing....... | +----------------------

Is there a C/C++ API to the route information on Windows?

夙愿已清 提交于 2019-11-30 21:10:56
Is there a windows or cygwin C/C++ API to collect information provided by the route command on Windows? I'm specifically interested in the route metrics. Here's an example of what route outputs, the IPs have been changed to protect the innocent. $ route PRINT -4 =========================================================================== Interface List 11...64 31 50 3b ba 96 ......Broadcom NetXtreme Gigabit Ethernet 17...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1 18...00 50 56 c0 00 08 ......VMware Virtual Ethernet Adapter for VMnet8 1...........................Software

Apache2.4 性能优化

纵然是瞬间 提交于 2019-11-30 19:21:26
前几天买了阿里云主机后,配置了基本的web环境,apache性能没有做优化;导致今天在公布 opms 系统的时候,访问太慢,本身的云主机配置是低配,自己玩的。具体环境配置请看《 再谈centOS7.2 LAMP源码安装及注意要点 》。 现把apache性能优化上做一下配置: 一. deflate和expires 我在安装apache的时候,已经自动静态编译了deflate和expires模块,所以可能在配置文件里直接添加相关指令: #deflate gzip启用 可以在主机配置文件httpd.conf或虚拟主机vhost下添加下面指令 DeflateCompressionLevel 9 SetOutputFilter DEFLATE AddOutputFilterByType DEFLATE text/html text/plain text/xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE image/gif image/png image/jpe image/swf image/jpeg image/bmp #expires 缓存模块,这里配置了1天的时间

TCP/IP协议

和自甴很熟 提交于 2019-11-30 19:07:49
参见 维基百科 互联网协议套件 (IPS: Internet Protocol Suite)是一个网络通信模型,以及一整个网络传输协议家族,组成了国际网络的基础通信架构。 TCP(传输控制协议) 和 IP(网际协议) 是IPS最早通过的标准。所以TCP/IP这名称代表一整套数据通信协议的组合。 互联网协议套件也被称为 TCP/IP协议簇 (TCP/IP Protocol Suite 或 TCP/IP Protocols), TCP/IP协议栈 (TCP/IP Stack)。 这些协议最早发源于美国国防部(DoD)的 ARPA网 项目,因此也被称作 DoD模型 (DoD Model)。 TCP/IP提供了点对点链接的机制,将数据应该如何封装、定址、传输、路由、接收以标准化。 1983年1月1日,因特网前身(ARPA网),通信方式由TCP/IP取代旧的网络控制协议(NCP, Network Control Protocol),这也成为今天互联网的基石。 TCP/IP由 Vinton Gray Cerf 和 Robert Elliot Kahn 开发。 TCP/IP成功有两点,一是1990年代中期,例如HTML和浏览器Mosaic的出现,促进互联网应用飞速发展。 二是对众多的低层协议(OSI模型中的第一层[物理层]和第二层[数据链路层])的支持。 IPv4(网际协议版本4)

Is there a C/C++ API to the route information on Windows?

元气小坏坏 提交于 2019-11-30 17:35:36
问题 Is there a windows or cygwin C/C++ API to collect information provided by the route command on Windows? I'm specifically interested in the route metrics. Here's an example of what route outputs, the IPs have been changed to protect the innocent. $ route PRINT -4 =========================================================================== Interface List 11...64 31 50 3b ba 96 ......Broadcom NetXtreme Gigabit Ethernet 17...00 50 56 c0 00 01 ......VMware Virtual Ethernet Adapter for VMnet1 18..

Linux服务器的性能调优实战篇CentOS6最小化安装后的优化

早过忘川 提交于 2019-11-30 16:48:34
一、CentOS6.8 X86_64 最小化安装后的优化 用服务器使记得一个原则,系统安装的应用包最小化,服务器越稳定。 (1)系统的基础优化   1)更新yum官方源   为了让Centos6.8系统使用速度更快的更新源,运维人员都会选择更换源,一般会原则网易的更新源。   #wget http://mirrors.163.com/ .help/CentOS6-Base-163.repo    下载repo文件   # cd /etc/yum.repos.d/   # mv CentOS-Base.repo CentOS-Base.repo.bak     备份repo文件   # mv CentOS6-Base-163.repo CentOS-Base.repo    替换repo文件    # yum clean all      清理yum缓存   # yum makecache     重建缓存   # yum update       升级Linux系统   # wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm  增加epel源,下载rpm文件   # rpm -ivh epel-release-6-8.noarch.rpm   # # yum -y

HttpServletRequest.getRemoteAddr() in Tomcat returns IPv6 formatted IP address

让人想犯罪 __ 提交于 2019-11-30 16:08:24
HttpServletRequest.getRemoteAddr() in Tomcat returns IPv6 formatted IP address, but I would like to configure it that returns IPv4. I access the servlet via 'localhost'. If I access it via '127.0.0.1' then returns IPv4 formatted IP address (see this answer ). Environment: Windows 7 x64 Tomcat 6.0.35-windows-x64 My LAN connection properties: IPv6 is checked off , but it doesn't work neither if I check it on. try adding this parameter -Djava.net.preferIPv4Stack=true to your tomcat startup commandline. when you use localhost/xxx, your browser first have to find the mapped address for the name