ipv4

Linux系统优化

怎甘沉沦 提交于 2019-12-04 19:57:45
临时调整内核参数 Linux系统参数随着系统的启动会被写入系统内存中,我们可以直接修改/proc/目录下的文件来调整内核参数,这种调整是立即生效的,下面是几个例子: 开启内核路由转发功能(通过0或1设置开关): [root@centos6 ~]# echo "1" > /proc/sys/net/ipv4/ip_forward 开启禁止其它主机ping本机功能: [root@centos6 ~]# echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all 调整所有的进程可以打开的文件总数量: [root@centos6 ~]# echo "108248" >/proc/sys/fs/file-max 永久调整内核参数 通过以上方法直接修改/proc相关文件的方式,不过在系统重启后就没有效果了,如果想要永久更改,可以修改/etc/sysctl.conf文件: [root@centos6 ~]# vim /etc/sysctl.conf net.ipv4.ip_forward = 1 net.ipv4.icmp_echo_ignore_all = 1 fs.file-max = 108248 注意: 通过sysctl.conf文件修改的参数不会立即生效,需要使用sysctl -p 命令设置立即生效。 来源: https://www

Why does IPAddress.MapToIPv4() throw ArgumentOutOfRangeException?

坚强是说给别人听的谎言 提交于 2019-12-04 17:02:36
问题 This code throws an ArgumentOutOfRangeException on the last line var initAddress = IPAddress.Parse("1.65.128.190"); var ipv6Address = initAddress.MapToIPv6(); Assert.IsTrue(ipv6Address.IsIPv4MappedToIPv6); var ipv4Address = ipv6Address.MapToIPv4(); Can anyone explain why MapToIPv6() and MapToIPv4() are not round trip compatible? edit: The exception originates from the IPAddress constructor, called by MapToIPv4(). Also, when the first line is var initAddress = IPAddress.Parse("1.65.128.90");

nmcli命令(转)

岁酱吖の 提交于 2019-12-04 14:24:53
https://www.jianshu.com/p/42bcbdcda617 nmcli [OBJECT参数] [显示参数] OBJECT参数 g[eneral] NetworkManager's general status and operations n[etworking] overall networking control r[adio] NetworkManager radio switches c[onnection] NetworkManager's connections d[evice] devices managed by NetworkManager a[gent] NetworkManager secret agent or polkit agent m[onitor] monitor NetworkManager changes 显示参数 show 显示详细信息 status 显示简略信息 查看接口信息 #简略信息 nmcli device status #详细信息 nmcli device show #接口的详细信息 nmcli device show interface-name 查看连接信息 #详细信息 nmcli connection show #某个接口的详细连接信息 nmcli connection show inteface-name

LVS-DR 模式

孤街浪徒 提交于 2019-12-04 14:03:52
环境: nat 网卡 192.168.10.0/24 网段 仅主机 网卡 10.0.0.0/8 网段 client 192.168.10.10/24 客户端 route 192.168.10.20/24 10.0.0.10/8 路由器 dr 10.0.0.40/8 LVS-DR 服务器 rs1 10.0.0.20/8 httpd 服务器 rs2 10.0.0.30/8 httpd 服务器 配置 client 环境 配置 IP 地址 配置 route 1、配置 IP地址 2、配置路由转发 配置 lvs dr 环境 1、配置 IP 地址 2、安装用户空间的命令行工具 3、编写 dr 脚本 #!/bin/bash vip='10.0.0.100' iface='lo:1' mask='255.255.255.255' port='80' rs1='10.0.0.20' rs2='10.0.0.30' scheduler='wrr' type='-g' rpm -q ipvsadm &> /dev/null || yum -y install ipvsadm &> /dev/null case $1 in start) ifconfig $iface $vip netmask $mask #broadcast $vip up iptables -F ipvsadm -A -t ${vip}

Listen on TCP4 not TCP6

你离开我真会死。 提交于 2019-12-04 12:16:09
I am using https://github.com/gin-gonic/gin to write an http service But when I deploy it, it keeps deploying on tcp6(according to netstat) r := gin.Default() //none of these are working , It keeps being listed on tcp6 r.Run(":8080") r.Run("*:8080") r.Run("0.0.0.0:8080") The documentation states Run attaches the router to a http.Server and starts listening and serving HTTP requests. It is a shortcut for http.ListenAndServe(addr, router) You can start the server directly using an http.Server the same way the http package does in ListenAndServe server := &http.Server{Handler: r} l, err := net

Binding Sockets to IPv6 Addresses

风格不统一 提交于 2019-12-04 11:52:21
问题 I am trying to write a web server that listens on both IPv4 and IPv6 addresses. However, the code that I originally wrote did not work. Then I found out that the IPv6 structures work for both IPv4 and IPv6. So now I use the IPv6 structures however, only the IPv4 addresses work. This post, why can't i bind ipv6 socket to a linklocal address, which said to add server.sin6_scope_id = 5; so I did that but it still does not accept IPv6 telnet connections. Any help would be greatly appreciated

[20191108]内核参数tcp_keepalive与sqlnet.ora expire_time的一些总结.txt

匆匆过客 提交于 2019-12-04 05:35:52
[20191108]内核参数tcp_keepalive与sqlnet.ora expire_time的一些总结.txt --//前几天在做12c DCD SQLNET.EXPIRE_TIME相关测试时,在11g数据库遇到1个古怪的问题,就是设置sqlnet.expire_time无效.不知道为 --//什么?以前做过类似测试就是在两个都设置的情况下,sqlnet.ora expire_time优先. --//我当时的情况如下,设置内核参数如下: net.ipv4.tcp_keepalive_time = 7200 net.ipv4.tcp_keepalive_intvl = 75 net.ipv4.tcp_keepalive_probes = 9 --//参数解析: /proc/sys/net/ipv4/tcp_keepalive_time 当keepalive起用的时候,TCP发送keepalive消息的频度。默认是2小时。 /proc/sys/net/ipv4/tcp_keepalive_intvl 当探测没有确认时,keepalive探测包的发送间隔。缺省是75秒。 /proc/sys/net/ipv4/tcp_keepalive_probes 如果对方不予应答,keepalive探测包的发送次数。缺省值是9。 --//sqlnet.ora,没有设置#SQLNET

How to find location based on IP address in Excel

拟墨画扇 提交于 2019-12-04 04:58:51
I've got a spreadsheet of about 5000 user events associated with IPs, and I'm trying to use IP to determine location using just an Excel formula. The IPs in my log are structured as "dotted quads" (decimal notation). I figured VLOOKUP is the way to go here, so I downloaded WEBNet77's IPV4 IpToCountry database , which seems like a comprehensive and up-to-date resource (is there a better resource out there for this purpose?). The database includes about 140K rows of IP ranges, with the sheet structured like so: Colum labels A - G are, respectively: IP FROM, IP TO, REGISTRY, ASSIGNED, CTRY, CNTRY

关于Nginx的一些优化(突破十万并发)

大憨熊 提交于 2019-12-03 23:24:52
本文介绍了一些能够提升Nginx性能的指令和一些Linux内核优化方案,这些参数在某些生产环境中已经应用并且 达到了不错的效果(如果带宽足够,甚至可能突破十万并发),每一个网站对应的业务都应该是不同的优化方案。 这篇文档适合于搭建某些静态请求较多,并且为大并发,需要快速处理请求的广告服务器或图片服务器。 nginx指令中的优化(配置文件) worker_processes 8; nginx进程数,建议按照cpu数目来指定,一般为它的倍数。 worker_cpu_affinity 00000001 00000010 00000100 00001000 00010000 00100000 01000000 10000000; 为每个进程分配cpu,上例中将8个进程分配到8个cpu,当然可以写多个,或者将一个进程分配到多个cpu。 worker_rlimit_nofile 102400; 这个指令是指当一个nginx进程打开的最多文件描述符数目,理论值应该是最多打开文件数(ulimit -n)与nginx进程数相除,但是nginx分配请求并不是那么均匀,所以最好与ulimit -n的值保持一致。 use epoll; 使用epoll的I/O模型,这个不用说了吧。 worker_connections 102400; 每个进程允许的最多连接数

nginx 高并发配置参数

时光总嘲笑我的痴心妄想 提交于 2019-12-03 22:34:55
一、一般来说nginx 配置文件中对优化比较有作用的为以下几项: 1. worker_processes 8; nginx 进程数,建议按照cpu 数目来指定,一般为它的倍数 (如,2个四核的cpu计为8)。 2. worker_cpu_affinity 00000001 0000001000000100 00001000 00010000 00100000 01000000 10000000; 为每个进程分配cpu,上例中将8 个进程分配到8 个cpu,当然可以写多个,或者将一 个进程分配到多个cpu。 3. worker_rlimit_nofile65535; 这个指令是指当一个nginx 进程打开的最多文件描述符数目,理论值应该是最多打开文 件数(ulimit -n)与nginx 进程数相除,但是nginx 分配请求并不是那么均匀,所以最好与ulimit -n的值保持一致。 现在在linux2.6内核下开启文件打开数为65535,worker_rlimit_nofile就相应应该填写65535。 这是因为nginx调度时分配请求到进程并不是那么的均衡,所以假如填写10240,总并发量达到3-4万时就有进程可能超过10240了,这时会返回502错误。 查看linux系统文件描述符的方法: [root@web001 ~]# sysctl -a | grep fs.file fs