分类: 网络 Network

  • EC2两张网卡连接两个子网,分别关联EIP,其中一个EIP ping不通,怎么办?

    问题


    – 一个有两张网卡的 EC2 instance (RHEL7.5),每个网卡分别对应一个public subnet, 每个网卡也关联一个 Public IP.
    – 从其他网络 ping 这两个 IP 地址,发现其中一个IP能ping通,另一个IP不能ping通。
    [cc lang=”text”]
    [ec2-user@ip-172-31-30-14 ~]$ ping 52.80.82.70 -c2
    PING 52.80.82.70 (52.80.82.70) 56(84) bytes of data.
    64 bytes from 52.80.82.70: icmp_seq=1 ttl=63 time=1.71 ms
    64 bytes from 52.80.82.70: icmp_seq=2 ttl=63 time=1.80 ms

    [ec2-user@ip-172-31-30-14 ~]$ ping 52.81.2.166 -c2
    PING 52.81.2.166 (52.81.2.166) 56(84) bytes of data.

    — 52.81.2.166 ping statistics —
    2 packets transmitted, 0 received, 100% packet loss, time 1004ms
    [/cc]

    (更多…)

  • Why do services like sendmail/httpd still query outdated DNS servers after resolv.conf is changed?

    Question

    One of my colleague raised a question: After changing resolv.conf, sendmail still query the old resolver, why?

    Steps:

    1. Set 192.168.122.65 as nameserver in resolv.conf, start sendmail service, send a mail to root@hat.com, and take a tcpdump. We can see there’s a query asking 192.168.122.65 for MX record of hat.com .

    2. Change nameserver from 192.168.122.65 to 192.168.122.72 in resolv.conf, send a mail to root@hat.com and take a tcpdump again. This time we expect a query to 192.168.122.72 (new), but the actual query is to 192.168.122.65 (old).

    3. Restart sendmail service, send a mail to root@hat.com, this time we can see a query to 192.168.122.72 (new) as expected.

    When we were thinking about what’s going wrong with sendmail, another colleague joined in discussion, and she mentioned that httpd and some other long-running services also have this behavior.

    Since sendmail is not the only case, I think we should have a check on glibc.

    (更多…)

  • Socket listen() backlog 是什么?

    listen() backlog 是什么?

    1. Linux 服务器上的一些程序会监听特定端口.

    2. 当有 client 连接到服务器的相应端口,进行完 tcp 三次握手之后,相应的连接会放到服务器相应 socket 的队列,等待服务器的应用程序调用 accept() 来读取这个连接;

    3. 这个队列的长度,就是 listen() backlog.

    以 apache httpd 为例。

    1. httpd 会监听 80 端口;

    2. 当有用户端连接到服务器的 80 端口,首先会进行 tcp 的三次握手。进行完三次握手后,这个连接会被放到 80 端口这个 socket 的队列里,等待 httpd 去获取这个连接;

    3. httpd 随后会调用 accept() 来获取这个连接。这个连接被获取之后,会从这个队列里移除;

    4. 这个监听 80 端口的 socket 对应的队列长度,就是 listen() backlog.
    (更多…)

  • 如何使用 Linux 中的 TCP keepalive?

    tcp-keepalive 是什么

    1. tcp-keepalive,顾名思义,它可以尽量让 TCP 连接“活着”,或者让一些对方无响应的 TCP 连接“宣告死亡”。

    2. 一些特定环境,防火墙会自动断开长期无活动的 TCP 连接,tcp-keepalive 可以在连接无活动一段时间后,发送一个空 ack,使 TCP 连接不会被防火墙关闭。

    3. 一些时候,对方的服务器可能出现宕机或者网络中断等问题, tcp-keepalive 可以帮助断开这些无响应的连接。

    4. tcp-keepalive 需要在应用程序层面针对其所用到的 Socket 进行开启。操作系统层面无法强制所有 socket 启用 tcp-keepalive. (本文在 CentOS/RHEL 6/7 环境进行测试)

    (更多…)

  • A simple TCP socket server example

    This is a very simple and buggy TCP socket example in Linux C. For demo only.
    (更多…)

  • 已解决: Virtualbox没有找到Host-Only Adapter

    在安装Software Defined Networking课程的虚拟机中,出现了问题:没有找到Host-Only Adapter。
    在http://askubuntu.com/questions/198452/no-host-only-adapter-selected 找到了答案,搬运过来。

    问题描述:
    添加Host-only Adapter的时候,遇到错误提示”no host only network adapter selected”,但没有可选的东西。
    1

    解决方法:
    1. 在Virtualbox的主菜单,选择 File -> Preference .(注意是整个Virtualbox的主菜单,不是某个单独虚拟机的设置页面);
    2. 选择左边的”Network”;
    3. 在”Host-only Networks”中,你应该只能看到一个白框。点击白框右边的绿色“添加”按钮,就会自动添加好一个Host-Only Adapter。这时候就基本可以使用了。
    4. 如果你是处女座非要设置点东西,你可以点击右边第三个按钮配置参数。默认参数如下:
    2
    3
    4
    Adapter:
    IPv4 address: 192.168.56.1
    IPv4 Network Mask: 255.255.255.0
    DHCP server:
    Enable server: checked
    Server Address: 192.168.56.100
    Server Mask: 255.255.255.0
    Lower Address Bound: 192.168.56.101
    Upper Address Bound: 192.168.56.254

  • Ubuntu下用VLC播放北邮IPTV

    IPTV高清且不需要收取流量费用,是个看高清电视的好选择。
    在教育网内打开 http://iptv.bupt.edu.cn,右键点击频道,复制地址。
    比如CCTV5+的地址是

    mms://officetv.bupt.edu.cn/CCTV-5plus-HD

    iptv bupt

    打开VLC播放器,打开媒体流。
    将播放地址复制进去,将mms修改成rtsp.
    即可顺利播放。

    rtsp://officetv.bupt.edu.cn/CCTV-5plus-HD

    iptv
    CCTV5+

  • 图解:快速计算冲突域和广播域数目

    考试喜欢出计算冲突域和广播域的题目,这里大概介绍快速计算冲突域和广播域的方法;
    (更多…)

  • 北邮IPTV无法播放 解决方法

    问题描述:
    Windows Media Player 错误:

    无法播放此文件,因为不支持指定的协议。如果在“打开 URL”对话框中键入了 URL,请尝试使用其他传输协议(例如“http:”或“rtsp:”)

    解决办法:

    开始>cmd (用管理员身份运行)。

    输入:regsvr32 wmnetmgr.dll
    重启计算机。

  • Chrome不能上网,但是IE可以。

      问题描述:

    1. Chrome不能上网。

    2. IE能正常上网,QQ能使用。

    3. Chrome提示,SOCKET NOT CONNECTED.

     

      解决方法:

    重置Windows SOCKET.

    1. 运行命令行,在开始菜单运行cmd.

    2. 在命令行模式,输入netsh winsock reset , 回车执行。

    3. 重启计算机。