NameCom DDNS 解决方案

2014-09-26 18:24:18 +0000

Namecom

众所周知 name.com 是一家域名注册商,相比较 Godaddy 它界面简洁操作方便,早年便从 Godaddy 转投了 name.com。

DDNS

家里用的是 DD-WRT 路由器,花生壳 ddns 时常不好用,很是烦恼,于是有了这个写个 python 脚本自动更新 IP的想法。

由于已经在 name.com 购买了一个域名,于是就像通过增加一个子域名 DNS Record 来实现 DDNS。 原理就是在路由器上跑一个脚本,每隔一段时间检查当前 IP 地址是否有变更,如果有则更新 name.com 上的记录。

开发过程很简单,首先提交一个 API Application Form 的申请,通过后会得到一个 API Token,然后通过 JSON 提交奥 http request 与 name.com 交互。

参考文档:


另外我将这个项目的源码放到了 github 上,有兴趣的可以看一下:

https://github.com/bluezd/NameComDomain

搬家到 BudgetVM

2014-07-25 10:34:52 +0000

Burst VPS

用了3年的 Burst VPS 破产了,于今天正式倒闭。之前选择 Burst VPS 就是因为便宜,没曾想突然倒闭了,交了一年的钱还剩三个月左右,官方也不给退款了。不过有提前通知,数据什么的早就有定时备份。

Budget VPS

于是乎迁移到了 BudegtVM, 虽然数据没丢,但对于一个长期用 wordpress 的人来说很是折腾,各种重装,各种重新配置,不喜欢折腾了。为什么选择它呢? 还是因为便宜。

我购买的是如下套餐:

  • Linux VPS (OpenVZ) – 1024MB VPS</p>
    • 1024MB Ram
    • 2048MB Ram Burst
    • 4 E5-2620 CPU Core
    • 80GB Disk Space
    • 3000GB Bandwidth
    • 3 IPv4 IP Address
    • 16 IPv6 IP Address

由于是 openvz 的 VM 有如下限制:

  • 只能装 Linux(可选择的发行版挺多的)
  • VPN 只能搞 openvpn, 翻墙的话建议 ssh -D

价格还行,买一年的话一个月 4 刀,开通速度也挺快的,没有购买其他 Control Panel, 只有一个很简单的。


总之个人觉得性价比还是挺高的,ping 值也还行,希望它坚挺些,别倒闭了,不想再折腾了。

2013 让我欢喜让我忧

2013-12-01 22:02:25 +0000

2013 年还有一个月就要过去了,年初信誓旦旦的定下了几个目标,如今在时间和现实面前显得那么的苍白。惭愧啊,总体来说这一年四个字差强人意吧。

工作

最近工作上有了些变动,transfer 到隔壁组做起了一个开发的工作,虽不是纯内核开发,但是觉得还是对自己有很大的锻炼价值,至少离我的目标更近了一步。有的时候期望越大恐怕失望就越大,还是保持一颗平常心吧,改掉一些坏习惯比如说眼高手低,努力把工作做好。

同时也感谢下以前的 Manager 以及所有帮过我的人,感谢你们在工作中给予的支持与帮助。

生活

作为一个北漂,来到这个陌生的城市纯粹是为了工作,我实在是找不到其它理由。北漂生活说实话苦,厌倦了租房,厌倦了糟糕的空气,更厌倦了挤公交地铁时的情景。有的时候就会问自己为什么明明不喜欢还要留下,满五年然后买房,然后用一辈子的时间来还贷,辛辛苦苦一辈子就为了买个房子 ?

想想这一年,每次最最开心的时候就是回家了。虽说从高中的时候就离开父母独自生活了,但是多愁善感的我每次走的时候还是那么的不舍,表面上装的很坚强很不屑,看着他们离去的背影心里还是那么的不好受。父母日渐老去,他们不指望着你能挣多少多少钱让他们能过上多么幸福的生活,只希望能多陪陪他们。我知道我没出息,男子汉应该志在四方,不能太在乎儿女情长,可是这就是最最真实的我啊。

而我确实也希望能有一个很好的事业。这个世道,钱的多少是检验一个男人成功与否的唯一标准,哎,做人难,做男人更难 。。。有的时候确实很纠结啊。

其它

作为一个 IT 屌丝,每天的业余的生活大家也都懂得,不是无聊,是相当无聊。

关于女朋友这个事情自己确实没有那么着急,可是身边的同事啊朋友啊大多数都有妹子了,有时候被刺激的确实受不了了。所以最近为了排遣寂寞,自己每天下班坚持看书,希望能在书的海洋中找回已经在寂寞中迷失的自己。

突然想起一句歌词:

迟两秒搭上
地下铁能与你碰上么
如提前十步
入电梯谁又被错过
和某某从来
未预约为何能见更多
全城来撞你
但最后处处有险阻

有些事情真的是力不从心啊,反正一切事情不强求顺其自然吧 。。。


2014

希望自己在新的一年中一切尽量顺利吧,说心想事成绝对是扯淡。

OVS LISP Tunnel Configuration

2013-11-19 19:32:16 +0000

Install

  1. git clone git://git.openvswitch.org/openvswitch
  2. cd openvswitch
  3. ./boot.sh
  4. ./configure --with-linux=/lib/modules/${uname -r}/build
  5. make
  6. make install;make modules_install
  7. modprobe openvswitch
  8. mkdir -p /usr/local/etc/openvswitch
  9. ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema

Startup

  1. ovsdb-server –remote=punix:/usr/local/var/run/openvswitch/db.sock
    –remote=db:Open_vSwitch,Open_vSwitch,manager_options
    –private-key=db:Open_vSwitch,SSL,private_key
    –certificate=db:Open_vSwitch,SSL,certificate
    –bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert
    –pidfile –detach
  2. ovs-vsctl --no-wait init
  3. ovs-vswitchd --pidfile --detach

LISP Tunnel Configuration

Topo

               +---+                               +---+
               |VM1|                               |VM2|
               +---+                               +---+
                 |                                   |
           +-- vnet0 --+                       +-- vnet0 --+
           |           |                       |           |
        lisp0   OVS1  eth0--------------------eth0  OVS2  lisp0
           |           |                       |           |
           +-----------+                       +-----------+
               Host1                               Host2

Configuration

  • Host1
    • ovs-vsctl add-br br1
    • ovs-vsctl add-br br2
    • ovs-vsctl add-port br1 em1
    • ifconfig em1 0;dhclient br1
    • ifconfig br2 10.1.1.1 netmask 255.255.255.0
    • ovs-vsctl add-port br2 lisp0 -- set Interface lisp0 type=lisp options:remote_ip=192.168.1.252
      192.168.1.252 is Host2 eth0’s ip address
    • ovs-ofctl add-flow br2 "priority=0,action=NORMAL"
    • ovs-ofctl add-flow br2 "priority=2,in_port=1,dl_type=0x0806,action=NORMAL"
    • ovs-ofctl add-flow br2 "priority=3,dl_dst=02:00:00:00:00:00,action=mod_dl_dst:52:54:00:B8:27:75,output:1"
      52:54:00:B8:27:75 is VM1’s mac address
    • ovs-ofctl add-flow br2 "priority=1,in_port=1,dl_type=0x0800,vlan_tci=0,nw_src=10.1.1.0/24,action=output:2"
  • VM1
    • virsh dumpxml kvm1 > domain.xml
    • search the XML section and change it to something like this:
    • virsh create domain.xml
    • ifconfig eth3 up
    • ifconfig eth3 10.1.1.20 netmask 255.255.255.0
    • echo "10.1.1.30 52:54:00:1B:EA:D5" > /etc/ethers
    • arp -f /etc/ethers

       <interface type=&#39;bridge&#39;>
         <mac address=&#39;52:54:00:b8:27:75&#39;/>
         <source bridge=&#39;br2&#39;/>
         <virtualport type=&#39;openvswitch&#39;>
         </virtualport>
         <model type=&#39;virtio&#39;/>
         <address type=&#39;pci&#39; domain=&#39;0x0000&#39; bus=&#39;0x00&#39; slot=&#39;0x03&#39; function=&#39;0x0&#39;/>
       </interface>
      

      ovs-vsctl show

      390982aa-7bf6-4dfd-84eb-76fe7654e73d Bridge “br2” Port “vnet0” Interface “vnet0” Port “lisp0” Interface “lisp0” type: lisp options: {remote_ip=”192.168.1.252”} Port “br2” Interface “br2” type: internal Bridge “br1” Port “br1” Interface “br1” type: internal Port “em1” Interface “em1”

      ovs-ofctl show br2

      OFPT_FEATURES_REPLY (xid=0x2): dpid:00008ad828ce7949 n_tables:254, n_buffers:256 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_T P_DST ENQUEUE 1(vnet0): addr:fe:54:00:b8:27:75 config: 0 state: 0 current: 10MB-FD COPPER speed: 10 Mbps now, 0 Mbps max 2(lisp0): addr:36:d5:4f:15:c0:7a config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max LOCAL(br2): addr:8a:d8:28:ce:79:49 config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0

      ovs-ofctl dump-ports br2

      OFPST_PORT reply (xid=0x2): 3 ports port 1: rx pkts=609, bytes=58706, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=341, bytes=33418, drop=0, errs=0, coll=0 port 2: rx pkts=429, bytes=42042, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=582, bytes=56532, drop=0, errs=0, coll=0 port LOCAL: rx pkts=6, bytes=468, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=296, bytes=28032, drop=0, errs=0, coll=0

      ovs-ofctl dump-flows br2

      NXST_FLOW reply (xid=0x4): cookie=0x0, duration=1615.828s, table=0, n_packets=195, n_bytes=19110, idle_age=1378, priority=3,dl_dst=02:00:00:00:00:00 a ctions=mod_dl_dst:52:54:00:b8:27:75,output:1 cookie=0x0, duration=1717.963s, table=0, n_packets=326, n_bytes=31948, idle_age=1539, priority=0 actions=NORMAL cookie=0x0, duration=1519.394s, table=0, n_packets=101, n_bytes=9898, idle_age=1378, priority=1,ip,in_port=1,vlan_tci=0x000 0,nw_src=10.1.1.0/24 actions=output:2 cookie=0x0, duration=1667.873s, table=0, n_packets=0, n_bytes=0, idle_age=1667, priority=2,arp,in_port=1 actions=NORMAL

  • Host2
    • ovs-vsctl add-br br1
    • ovs-vsctl add-br br2
    • ovs-vsctl add-port br1 eth0
    • ifconfig em1 0;dhclient br1
    • ifconfig br2 10.1.1.2 netmask 255.255.255.0
    • ovs-vsctl add-port br2 lisp0 -- set Interface lisp0 type=lisp options:remote_ip=192.168.1.249
    • ovs-ofctl add-flow br2 "priority=0,action=NORMAL"
    • ovs-ofctl add-flow br2 "priority=2,in_port=1,dl_type=0x0806,action=NORMAL"
    • ovs-ofctl add-flow br2 "priority=3,dl_dst=02:00:00:00:00:00,action=mod_dl_dst:52:54:00:1B:EA:D5,output:1" 52:54:00:1B:EA:D5 is VM2’s mac address
    • ovs-ofctl add-flow br2 "priority=1,in_port=1,dl_type=0x0800,vlan_tci=0,nw_src=10.1.1.0/24,action=output:2"
  • VM2
    • redid the configuration as VM1
    • ifconfig eth5 up
    • ifconfig eth5 10.1.1.30 netmask 255.255.255.0
    • echo "10.1.1.20 52:54:00:B8:27:75" > /etc/ethers
    • arp -f /etc/ethers

      ovs-vsctl show

      66f0d773-a7c9-451e-980b-c2def85eda23 Bridge “br2” Port “br2” Interface “br2” type: internal Port “lisp0” Interface “lisp0” type: lisp options: {remote_ip=”192.168.1.249”} Port “vnet0” Interface “vnet0” Bridge “br1” Port “eth0” Interface “eth0” Port “br1” Interface “br1” type: internal

      ovs-ofctl show br2

      OFPT_FEATURES_REPLY (xid=0x2): dpid:00001e2e0e0cf040 n_tables:254, n_buffers:256 capabilities: FLOW_STATS TABLE_STATS PORT_STATS QUEUE_STATS ARP_MATCH_IP actions: OUTPUT SET_VLAN_VID SET_VLAN_PCP STRIP_VLAN SET_DL_SRC SET_DL_DST SET_NW_SRC SET_NW_DST SET_NW_TOS SET_TP_SRC SET_T P_DST ENQUEUE 1(vnet0): addr:fe:54:00:1b:ea:d5 config: 0 state: 0 current: 10MB-FD COPPER speed: 10 Mbps now, 0 Mbps max 2(lisp0): addr:96:fa:62:5b:6f:09 config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max LOCAL(br2): addr:1e:2e:0e:0c:f0:40 config: 0 state: 0 speed: 0 Mbps now, 0 Mbps max OFPT_GET_CONFIG_REPLY (xid=0x4): frags=normal miss_send_len=0

      ovs-ofctl dump-ports br2

      OFPST_PORT reply (xid=0x2): 3 ports port 1: rx pkts=657, bytes=60526, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=401, bytes=39094, drop=0, errs=0, coll=0 port 2: rx pkts=617, bytes=60466, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=593, bytes=54754, drop=0, errs=0, coll=0 port LOCAL: rx pkts=11, bytes=790, drop=0, errs=0, frame=0, over=0, crc=0 tx pkts=294, bytes=24952, drop=0, errs=0, coll=0

      ovs-ofctl dump-flows br2

      NXST_FLOW reply (xid=0x4): cookie=0x0, duration=246.526s, table=0, n_packets=38, n_bytes=3724, idle_age=170, priority=3,dl_dst=02:00:00:00:00:00 actio ns=mod_dl_dst:52:54:00:1b:ea:d5,output:1 cookie=0x0, duration=293.084s, table=0, n_packets=98, n_bytes=9604, idle_age=234, priority=0 actions=NORMAL cookie=0x0, duration=194.739s, table=0, n_packets=23, n_bytes=2254, idle_age=170, priority=1,ip,in_port=1,vlan_tci=0x0000,n w_src=10.1.1.0/24 actions=output:2 cookie=0x0, duration=285.264s, table=0, n_packets=0, n_bytes=0, idle_age=285, priority=2,arp,in_port=1 actions=NORMAL

Test

ping test:

    # ping 10.1.1.30
    PING 10.1.1.30 (10.1.1.30) 56(84) bytes of data.
    64 bytes from 10.1.1.30: icmp_seq=1 ttl=64 time=3.51 ms
    64 bytes from 10.1.1.30: icmp_seq=2 ttl=64 time=1.21 ms
    64 bytes from 10.1.1.30: icmp_seq=3 ttl=64 time=1.62 ms
    64 bytes from 10.1.1.30: icmp_seq=4 ttl=64 time=1.80 ms
    64 bytes from 10.1.1.30: icmp_seq=5 ttl=64 time=1.33 ms
    64 bytes from 10.1.1.30: icmp_seq=6 ttl=64 time=1.49 ms
    64 bytes from 10.1.1.30: icmp_seq=7 ttl=64 time=1.66 ms

    Capture the packets on VM2 at the same time:   

    # tcpdump -i eth5 -xxx
    tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
    listening on eth5, link-type EN10MB (Ethernet), capture size 65535 bytes
    03:01:22.900663 IP 10.1.1.20 > 10.1.1.30: ICMP echo request, id 59656, seq 1, length 64
        0x0000:  5254 001b ead5 0200 0000 0000 0800 4500
        0x0010:  0054 0000 4000 4001 2476 0a01 0114 0a01
        0x0020:  011e 0800 cb2f e908 0001 533d 7f52 0000
        0x0030:  0000 ae63 0400 0000 0000 1011 1213 1415
        0x0040:  1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
        0x0050:  2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
        0x0060:  3637
    03:01:22.900735 IP 10.1.1.30 > 10.1.1.20: ICMP echo reply, id 59656, seq 1, length 64
        0x0000:  5254 00b8 2775 5254 001b ead5 0800 4500
        0x0010:  0054 fff3 0000 4001 6482 0a01 011e 0a01
        0x0020:  0114 0000 d32f e908 0001 533d 7f52 0000
        0x0030:  0000 ae63 0400 0000 0000 1011 1213 1415
        0x0040:  1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
        0x0050:  2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
        0x0060:  3637

ftrace debug(send):

  • cd /sys/kernel/debug/tracing
  • echo "iptunnel_xmit" > set_ftrace_filter
  • echo "function" > current_tracer
  • echo "1" > tracing_on

    # cat trace
    # tracer: function
    #
    # entries-in-buffer/entries-written: 6/6   #P:4
    #
    #                              _-----=> irqs-off
    #                             / _----=> need-resched
    #                            | / _---=> hardirq/softirq
    #                            || / _--=> preempt-depth
    #                            ||| /     delay
    #           TASK-PID   CPU#  ||||    TIMESTAMP  FUNCTION
    #              | |       |   ||||       |         |
        upcall_6-2529  001 ..s. 78269.070472: iptunnel_xmit -lisp_send
         vhost-31615-31617 003 ..s. 78270.070891: iptunnel_xmit -lisp_send
         vhost-31615-31617 000 ..s. 78271.072337: iptunnel_xmit -lisp_send
         vhost-31615-31617 000 ..s. 78272.073472: iptunnel_xmit -lisp_send
         vhost-31615-31617 000 ..s. 78273.075184: iptunnel_xmit -lisp_send
         vhost-31615-31617 002 ..s. 78274.076124: iptunnel_xmit -lisp_send
    

ftrace debug(reveive):

  • cd /sys/kernel/debug/tracing
  • echo "ovs_vport_receive" > set_ftrace_filter
  • echo "function" > current_tracer
  • echo "1" > tracing_on

    # cat trace | grep lisp_rcv
        upcall_5-2530  003 ..s1 78668.265341: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78669.266634: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78670.268925: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78671.269857: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78672.271818: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78673.273648: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78674.275753: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78675.277631: ovs_vport_receive -lisp_rcv
            Xorg-743   002 ..s. 78676.279053: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78677.281010: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78678.282785: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78679.284470: ovs_vport_receive -lisp_rcv
          <idle>-0     002 ..s. 78680.285205: ovs_vport_receive -lisp_rcv
    

All done.

OVS GRE Tunnel Configuration

2013-11-10 17:54:49 +0000

Install

  1. git clone git://git.openvswitch.org/openvswitch
  2. cd openvswitch
  3. ./boot.sh
  4. ./configure --with-linux=/lib/modules/${uname -r}/build
  5. make
  6. make install
  7. make modules_install
  8. modprobe openvswitch
  9. mkdir -p /usr/local/etc/openvswitch
  10. ovsdb-tool create /usr/local/etc/openvswitch/conf.db vswitchd/vswitch.ovsschema

Startup

  1. ovsdb-server –remote=punix:/usr/local/var/run/openvswitch/db.sock
    –remote=db:Open_vSwitch,Open_vSwitch,manager_options
    –private-key=db:Open_vSwitch,SSL,private_key
    –certificate=db:Open_vSwitch,SSL,certificate
    –bootstrap-ca-cert=db:Open_vSwitch,SSL,ca_cert
    –pidfile –detach
  2. ovs-vsctl --no-wait init
  3. ovs-vswitchd --pidfile --detach

GRE tunnel Configuration

  • Host1
    • ovs-vsctl add-br br1
    • ovs-vsctl add-br br2
    • ovs-vsctl add-port br1 em1
    • ifconfig em1 0;dhclient br1
    • ifconfig br2 10.1.1.1 netmask 255.255.255.0
    • ovs-vsctl add-port br2 gre0 -- set interface gre0 type=gre options:remote_ip=192.168.1.252
  • VM1
    • virsh dumpxml kvm1 > domain.xml
    • search the XML <interface type='network'> section and change it to something like this(see below):
    • virsh create domain.xml
    • ifconfig eth3 up
    • ifconfig eth3 10.1.1.20 netmask 255.255.255.0

        <interface type=&#39;bridge&#39;>
          <mac address=&#39;52:54:00:b8:27:75&#39;/>
          <source bridge=&#39;br2&#39;/>
          <virtualport type=&#39;openvswitch&#39;>
          </virtualport> 
          <model type=&#39;virtio&#39;/> 
          <address type=&#39;pci&#39; domain=&#39;0x0000&#39; bus=&#39;0x00&#39; slot=&#39;0x03&#39; function=&#39;0x0&#39;/> 
        </interface> 
      

      ovs-vsctl show

      390982aa-7bf6-4dfd-84eb-76fe7654e73d Bridge “br2” Port “vnet0” Interface “vnet0” Port “br2” Interface “br2” type: internal Port “gre0” Interface “gre0” type: gre options: {remote_ip=”192.168.1.252”} Bridge “br1” Port “br1” Interface “br1” type: internal Port “em1” Interface “em1”

  • Host2
    • ovs-vsctl add-br br1
    • ovs-vsctl add-br br2
    • ovs-vsctl add-port br1 eth0
    • ifconfig em1 0;dhclient br1
    • ifconfig br2 10.1.1.2 netmask 255.255.255.0
    • ovs-vsctl add-port br2 gre0 -- set interface gre0 type=gre options:remote_ip=192.168.1.249
  • VM2
    • redid the configuration as VM1
    • ifconfig eth5 up
    • ifconfig eth5 10.1.1.30 netmask 255.255.255.0

      ovs-vsctl show

      66f0d773-a7c9-451e-980b-c2def85eda23 Bridge “br1” Port “eth0” Interface “eth0” Port “br1” Interface “br1” type: internal Bridge “br2” Port “gre0” Interface “gre0” type: gre options: {remote_ip=”192.168.1.249”} Port “br2” Interface “br2” type: internal Port “vnet0” Interface “vnet0”

Test

ping VM2 on VM1:

    # ping 10.1.1.30
    PING 10.1.1.30 (10.1.1.30) 56(84) bytes of data.
    64 bytes from 10.1.1.30: icmp_seq=1 ttl=64 time=3.66 ms
    64 bytes from 10.1.1.30: icmp_seq=2 ttl=64 time=1.82 ms
    64 bytes from 10.1.1.30: icmp_seq=3 ttl=64 time=1.47 ms
    64 bytes from 10.1.1.30: icmp_seq=4 ttl=64 time=1.64 ms
    64 bytes from 10.1.1.30: icmp_seq=5 ttl=64 time=1.64 ms

capture the packets on VM2 at the same time:

    # tcpdump -i eth5 -xxx    
    08:24:38.425182 IP 10.1.1.20 > 10.1.1.30: ICMP echo request, id 53255, seq 1, length 64
        0x0000:  5254 001b ead5 5254 00b8 2775 0800 4500
        0x0010:  0054 0000 4000 4001 2476 0a01 0114 0a01
        0x0020:  011e 0800 263f d007 0001 96f1 7852 0000
        0x0030:  0000 2aa1 0900 0000 0000 1011 1213 1415
        0x0040:  1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
        0x0050:  2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
        0x0060:  3637
    08:24:38.425262 IP 10.1.1.30 > 10.1.1.20: ICMP echo reply, id 53255, seq 1, length 64
        0x0000:  5254 00b8 2775 5254 001b ead5 0800 4500
        0x0010:  0054 8ef0 0000 4001 d585 0a01 011e 0a01
        0x0020:  0114 0000 2e3f d007 0001 96f1 7852 0000
        0x0030:  0000 2aa1 0900 0000 0000 1011 1213 1415
        0x0040:  1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
        0x0050:  2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
        0x0060:  3637
    08:24:39.426066 IP 10.1.1.20 > 10.1.1.30: ICMP echo request, id 53255, seq 2, length 64
        0x0000:  5254 001b ead5 5254 00b8 2775 0800 4500
        0x0010:  0054 0000 4000 4001 2476 0a01 0114 0a01
        0x0020:  011e 0800 d835 d007 0002 97f1 7852 0000
        0x0030:  0000 77a9 0900 0000 0000 1011 1213 1415
        0x0040:  1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
        0x0050:  2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
        0x0060:  3637
    08:24:39.426135 IP 10.1.1.30 > 10.1.1.20: ICMP echo reply, id 53255, seq 2, length 64
        0x0000:  5254 00b8 2775 5254 001b ead5 0800 4500
        0x0010:  0054 8ef1 0000 4001 d584 0a01 011e 0a01
        0x0020:  0114 0000 e035 d007 0002 97f1 7852 0000
        0x0030:  0000 77a9 0900 0000 0000 1011 1213 1415
        0x0040:  1617 1819 1a1b 1c1d 1e1f 2021 2223 2425
        0x0050:  2627 2829 2a2b 2c2d 2e2f 3031 3233 3435
        0x0060:  3637

ftrace debug:

  • cd /sys/kernel/debug/tracing
  • echo "iptunnel_xmit" > set_ftrace_filter
  • echo "function_graph" > current_tracer
  • echo "1" > tracing_on

    # cat trace
    # tracer: function_graph
    #
    # CPU  DURATION                  FUNCTION CALLS
    # |     |   |                     |   |   |   |
     0) + 63.180 us   |  iptunnel_xmit [openvswitch]();
     0) + 29.963 us   |  iptunnel_xmit [openvswitch]();
     1) + 51.486 us   |  iptunnel_xmit [openvswitch]();
     2) + 49.981 us   |  iptunnel_xmit [openvswitch]();
     ------------------------------------------
     0)  upcall_-1891  =>  vhost-2-2339 
     ------------------------------------------
    
     0) + 11.770 us   |  iptunnel_xmit [openvswitch]();
     2) + 45.533 us   |  iptunnel_xmit [openvswitch]();
     2) + 48.497 us   |  iptunnel_xmit [openvswitch]();
     2) + 48.216 us   |  iptunnel_xmit [openvswitch]();
     2) + 48.348 us   |  iptunnel_xmit [openvswitch]();
    

Gre Tunnel 就介绍到这里,之后会简单的介绍下 LISP Tunnel 的配置过程

References

  1. http://wangcong.org/blog/archives/2163
  2. http://networkstatic.net/open-vswitch-gre-tunnel-configuration/