当前位置:首页>Linux>深入理解 Linux IPIP 隧道:从原理到实战

深入理解 Linux IPIP 隧道:从原理到实战

  • 2026-01-20 18:51:09
深入理解 Linux IPIP 隧道:从原理到实战

一、引言:跨网段通信的烦恼

假设你有两台服务器,一台在北京,一台在上海,它们各自都有一个公网 IP,但内部分别在不同的私有网段中。北京的服务器在 192.168.10.0/24 网段,上海的服务器在 192.168.20.0/24 网段。现在有个需求:这两个私有网段要能直接通信,就像在同一局域网一样。

你可能会想到很多方案:申请专线成本太高;使用 VPN 配置复杂;修改公网路由不现实。有没有一种轻量级、简单易用的方案?

答案就是 IPIP 隧道。

┌─────────────────────────────────────────────────────────────────────────┐│                          跨网段通信需求                                   ││                                                                          ││      ┌─────────────────────┐                   ┌─────────────────────┐   ││      │     北京机房         │                   │     上海机房          │   ││      │                     │                   │                     │   ││      │  192.168.10.0/24    │                   │  192.168.20.0/24    │   ││      │         ┌──────────┐│                   │         ┌──────────┐│   ││      │         │ Server A ││                   │         │ Server B ││   ││      │         │  .10.10  ││                   │         │  .20.20  ││   ││      │         └──────────┘│                   │         └──────────┘│   ││      │           │         │                   │           │         │   ││      └───────────┼─────────┘                   └───────────┼─────────┘   ││                  │                                         │              ││           公网 IP: 203.0.113.10                  公网 IP: 203.0.113.20     ││                  │                                         │              ││                  └──────────────── ✖ ──────────────────────┘              ││                              私有网段无法直接通信                            │└───────────────────────────────────────────────────────────────────────────┘

图示说明:北京和上海机房的私有网段需要互通,但公网无法路由私有 IP

1.1 什么是隧道技术?

在解释 IPIP 之前,我们先理解隧道技术的本质。

想象一条河流分隔了两个城市,河的一边是城市 A,另一边是城市 B。汽车无法直接开过河(就像私有 IP 无法在公网上路由)。但是有一艘渡轮(隧道),可以把汽车从一边运到另一边。汽车开上渡轮(数据被封装),渡轮载着汽车过河(数据在公网上传输),到达对岸后汽车下船(数据被解封装)。

这就是隧道技术的核心思想:将一种协议的数据包封装在另一种协议中进行传输

1.2 什么是 IPIP 隧道?

IPIP(IP in IP) 是一种简单的隧道协议,它将一个 IP 数据包完整地封装在另一个 IP 数据包中进行传输。IPIP 协议在 IP 头中的协议号是 4

┌─────────────────────────────────────────────────────────────────┐│                    IPIP 隧道原理                                  ││                                                                  ││   发送端                                      接收端              ││     │                                          │               ││     │  原始数据包                               │               ││     │  ┌──────────────────────────┐            │               ││     │  │  源IP: 192.168.10.10     │            │               ││     │  │  目标IP: 192.168.20.20   │            │               ││     │  └──────────────────────────┘            │               ││     │          │                               │               ││     │          ▼                               │               ││     │  ┌──────────────────────────┐            │               ││     │  │  原始 IP 头 (20字节)      │            │               ││     │  │  数据                    │            │               ││     │  └──────────────────────────┘            │               ││     │          │                               │               ││     │          ▼                               │               ││     │  ┌─────────────────────────────────┐    │               ││     │  │  外层 IP 头 (源: 203.0.113.10)   │    │               ││     │  │  │  原始 IP 头 (20字节)           │    │               ││     │  │  │  数据                         │    │               ││     │  │  └──────────────────────────┘   │                    ││     │  └─────────────────────────────────┘    │               ││     │          │                               │               ││     │          ▼                               │               ││     │  通过公网传输                             │               ││     │  ┌─────────────────────────────────┐    │               ││     │  │  外层 IP 头 (目标: 203.0.113.20)  │───►│               ││     │  │  │  原始 IP 头                   │    │               ││     │  │  │  数据                         │    │               ││     │  │  └──────────────────────────┘    │                   ││     │  └─────────────────────────────────┘    │               ││     │          │                               │               ││     │          ▼                               │               ││     │  解封装:剥除外层头                         │               ││     │  ┌──────────────────────────┐            │               ││     │  │  源IP: 192.168.10.10     │            │               ││     │  │  目标IP: 192.168.20.20   │            │               ││     │  └──────────────────────────┘            │               ││     │                                           │               │└─────────────────────────────────────────────────────────────────┘

图示说明:IPIP 隧道将原始数据包封装在新的 IP 头中,外层 IP 包含公网地址,内层 IP 包含私有地址


二、IPIP 隧道核心原理

理解了基本概念后,我们深入了解 IPIP 的工作原理。

2.1 数据包封装过程

当数据通过 IPIP 隧道传输时,会经历以下步骤:

步骤一:原始数据包生成

应用程序发送数据包,目标地址是对方私有网段中的某个 IP:

# 例如,从 Server A (192.168.10.10) 访问 Server B (192.168.20.20)$ ping 192.168.20.20

步骤二:路由决策

内核查询路由表,发现目标地址 192.168.20.20 通过隧道接口 tunl0 转发:

# 查看路由表$ ip route show192.168.20.0/24 dev tunl0 proto kernel scope link src 192.168.20.1010.0.0.0/8 via 192.168.10.1 dev eth0192.168.10.0/24 dev eth0 proto kernel scope link src 192.168.10.10

步骤三:封装

隧道驱动将原始 IP 数据包作为载荷,添加一个新的 IP 头:

┌─────────────────────────────────────────────────────────────────────┐│                       IPIP 封装后的数据包                             │├─────────────────────────────────────────────────────────────────────┤│                                                                      ││  ┌────────────────────────────────────────────────────────────────┐ ││  │                    外层 IP 头 (20 字节)                         │ ││  │  ┌────────┬────────┬─────────┬───────────────────────────────┐ │ ││  │  │ Version│ IHL    │ TOS     │ Total Length                  │ │ ││  │  ├────────┼────────┼─────────┼───────────────────────────────┤ │ ││  │  │ Identification  │ Flags   │ Fragment Offset             │ │ ││  │  ├────────┼────────┼─────────┼───────────────────────────────┤ │ ││  │  │ TTL    │ Proto=4│ Checksum│ Source IP: 203.0.113.10      │ │ ││  │  ├────────┼────────┼─────────┼───────────────────────────────┤ │ ││  │  │ Destination IP: 203.0.113.20                               │ │ ││  │  └────────────────────────────────────────────────────────────┘ │ ││  └────────────────────────────────────────────────────────────────┘ ││                                                                      ││  ┌────────────────────────────────────────────────────────────────┐ ││  │                    内层 IP 头 (20 字节)                         │ ││  │  ┌────────┬────────┬─────────┬───────────────────────────────┐ │ ││  │  │ Version│ IHL    │ TOS     │ Total Length                  │ │ ││  │  ├────────┼────────┼─────────┼───────────────────────────────┤ │ ││  │  │ Identification  │ Flags   │ Fragment Offset             │ │ ││  │  ├────────┴────────┴─────────┴───────────────────────────────┤ │ ││  │  │ TTL    │ Proto=1│ Checksum│ Source IP: 192.168.10.10     │ │ ││  │  ├────────┼────────┼─────────┼───────────────────────────────┤ │ ││  │  │ Destination IP: 192.168.20.20                             │ │ ││  │  └────────────────────────────────────────────────────────────┘ │ ││  └────────────────────────────────────────────────────────────────┘ ││                                                                      ││  ┌────────────────────────────────────────────────────────────────┐ ││  │                         ICMP 数据                               │ ││  └────────────────────────────────────────────────────────────────┘ ││                                                                      │└─────────────────────────────────────────────────────────────────────┘

请求头信息:

Version

IP 版本,IPv4 为4

IHL

Internet Header Length,头部长度(以 32-bit 字为单位),通常为 5(即 20 字节)

TOS / DSCP

服务类型(Type of Service)或现在的 DiffServ 字段

Total Length

整个 IP 包长度(包括头部和数据),单位:字节

Identification

用于分片重组的唯一标识符

Flags

分片标志(如 DF "Don't Fragment", MF "More Fragments")

Fragment Offset

分片偏移量(以 8 字节为单位)

TTL

Time To Live,跳数限制

Protocol

上层协议号Proto=4表示上层是 IP-in-IP,注意区别 Version 的 4 表示 IPv4 包)

IANA 协议号列表:https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml

Header Checksum

头部校验和(仅校验 IP 头)

Source IP

源 IP 地址,如203.0.113.10

(这是 RFC 5737 中的文档专用地址)

2.2 协议号详解

IPIP 协议在 IP 头中的协议号(Protocol Field)是 4。这意味着当路由器看到一个 IP 数据包的协议号是 4 时,就知道这是一个 IPIP 封装的数据包,需要进行解封装处理。

# 查看 /etc/protocols 文件确认$ grep ipip /etc/protocolsipip    4       IP-in-IP encapsulation          # IPIP 协议号 4

2.3 解封装过程

当数据包到达目标服务器的隧道接口后:

  1. 网卡接收数据包,检查外层 IP 头的协议号
  2. 发现协议号是 4,交给 IPIP 隧道驱动处理
  3. 隧道驱动剥除外层 IP 头
  4. 将原始数据包交给内核网络协议栈处理
  5. 内核查询路由,发现目标地址是本机,交给对应应用
┌─────────────────────────────────────────────────────────────────────┐│                         解封装流程                                   ││                                                                      ││  ┌─────────┐      ┌─────────┐      ┌─────────┐      ┌─────────┐   ││  │ 接收数据 │ ───► │ 检查协议  │ ───► │ 剥离外层 │ ───► │ 路由查找 │   ││  │   包     │     │   号 4   │      │   头    │      │         │   ││  └─────────┘      └─────────┘      └─────────┘      └─────────┘   ││                                                                      ││  ┌─────────┐      ┌─────────┐      ┌─────────┐                     ││  │ 交给应用 │ ◄───  │ 协议栈  │ ◄─── │ 本机地址 │                     ││  │         │      │  处理   │      │   匹配   │                     ││  └─────────┘      └─────────┘      └─────────┘                     ││                                                                      │└─────────────────────────────────────────────────────────────────────┘

2.4 MTU 问题

这是 IPIP 隧道配置中最容易遇到的问题。

为什么需要调整 MTU?

标准以太网 MTU 是 1500 字节。IPIP 封装会额外增加 20 字节(外层 IP 头)。如果不调整,可能导致数据包被分片,影响性能甚至导致通信失败。

计算公式:

隧道 MTU = 物理接口 MTU - 外层 IP 头大小 - 内层 IP 头最小大小          = 1500 - 20 - 20          = 1460 字节

考虑到一些特殊情况,建议设置更保守的值:

# 推荐设置隧道 MTU 为 1400 或更小ip link set tunl0 mtu 1400

三、实战:搭建 IPIP 隧道

现在我们来动手搭建一个 IPIP 隧道。假设场景如下:

参数

北京服务器 (Server A)

上海服务器 (Server B)

公网 IP

203.0.113.10

203.0.113.20

私网网段

192.168.10.0/24

192.168.20.0/24

隧道 IP

10.0.0.1/30

10.0.0.2/30

┌─────────────────────────────────────────────────────────────────────────┐                         IPIP 隧道拓扑                                                                                                                   北京机房 (203.0.113.10)                 上海机房 (203.0.113.20)                                                                                          公网互联网                                                              ─────────────────────────────────────│─                                                                                              ┌──────┴──────┐                          ┌──────┴──────┐                   eth0                                   eth0                       203.0.113.10                           203.0.113.20                └──────┬──────┘                          └──────┬──────┘                                                                                       ┌──────┴──────┐                          ┌──────┴──────┐                   tunl0     │◄────────────────────────►│   tunl0                       10.0.0.1         IPIP 隧道              10.0.0.2                   └──────┬──────┘                          └──────┬──────┘                                                                                       ┌──────┴──────┐                          ┌──────┴──────┐                  私网 eth1                               私网 eth1                   192.168.10.10                          192.168.20.20                └──────┬──────┘                          └──────┬──────┘                                                                                         192.168.10.0/24                         192.168.20.0/24            └─────────────────────────────────────────────────────────────────────────┘

3.1 环境准备

首先确认系统支持 IPIP 隧道:

# 检查内核模块是否加载$ lsmod | grep ipipipip                  24576  0 tunnel4               16384  1 ipipip_tunnel             28672  1 ipip# 如果没有加载,手动加载$ sudo modprobe ipip# 确认加载成功$ lsmod | grep ipipipip                  24576  0 tunnel4               16384  1 ipipip_tunnel             28672  1 ipip

3.2 配置北京服务器 (Server A)

# 1. 创建隧道接口$ sudo ip tunnel add tunl0 mode ipip remote 203.0.113.20 local 203.0.113.10# 参数说明:#   tunl0            - 隧道接口名称#   mode ipip        - 隧道模式为 IPIP#   remote 203.0.113.20 - 远程公网 IP#   local 203.0.113.10  - 本地公网 IP# 2. 启动隧道接口$ sudo ip link set tunl0 up# 3. 配置隧道 IP 地址$ sudo ip addr add 10.0.0.1/30 dev tunl0# 4. 设置 MTU(重要!)$ sudo ip link set tunl0 mtu 1400# 5. 添加路由,访问对方私网网段通过隧道# 这里的 via 10.0.0.2 仅用于标识隧道逻辑地址,不参与路由转发决策$ sudo ip route add 192.168.20.0/24 via 10.0.0.2 dev tunl0# 6. 验证配置$ ip addr show tunl0tunl0@NONE: <NOARP,UP,LOWER_UP> mtu 1400 qdisc noqueue state UNKNOWN group default qlen 1000    link/ipip 0.0.0.0 brd 0.0.0.0    inet 10.0.0.1/30 scope global tunl0       valid_lft forever preferred_lft forever$ ip route show10.0.0.0/30 dev tunl0 proto kernel scope link src 10.0.0.1 192.168.20.0/24 via 10.0.0.2 dev tunl0 src 10.0.0.1192.168.10.0/24 dev eth1 proto kernel scope link src 192.168.10.1010.0.0.0/8 via 192.168.10.1 dev eth1

3.3 配置上海服务器 (Server B)

# 1. 创建隧道接口$ sudo ip tunnel add tunl0 mode ipip remote 203.0.113.10 local 203.0.113.20# 2. 启动隧道接口$ sudo ip link set tunl0 up# 3. 配置隧道 IP 地址$ sudo ip addr add 10.0.0.2/30 dev tunl0# 4. 设置 MTU$ sudo ip link set tunl0 mtu 1400# 5. 添加路由,访问对方私网网段通过隧道$ sudo ip route add 192.168.10.0/24 via 10.0.0.1 dev tunl0

3.4 测试隧道连通性

在 北京服务器 上测试:

# 1. 测试隧道接口连通性$ ping -c 3 10.0.0.2PING 10.0.0.2 (10.0.0.256(84bytes of data.64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=10.5 ms64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=10.3 ms64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=10.2 ms# 2. 测试上海私网连通性$ ping -c 3 192.168.20.20PING 192.168.20.20 (192.168.20.2056(84bytes of data.64 bytes from 192.168.20.20: icmp_seq=1 ttl=62 time=11.2 ms64 bytes from 192.168.20.20: icmp_seq=2 ttl=62 time=11.0 ms64 bytes from 192.168.20.20: icmp_seq=3 ttl=62 time=10.8 ms

3.5 抓包验证封装

在任意一台服务器上使用 tcpdump 抓包,验证 IPIP 封装:

# 在北京服务器上抓取公网网卡$ sudo tcpdump -i eth0 -n -v | grep -E "IP|IPIP"# 正常会看到类似输出:# 10:05:23.123456 IP 203.0.113.10 > 203.0.113.20: IPIP 192.168.10.10 > 192.168.20.20: ICMP echo request# 10:05:23.124567 IP 203.0.113.20 > 203.0.113.10: IPIP 192.168.20.20 > 192.168.10.10: ICMP echo reply

从抓包结果可以清晰看到:

  • 外层 IP:203.0.113.10 → 203.0.113.20
  • 内层 IP:192.168.10.10 → 192.168.20.20
  • 协议类型:IPIP

四、配置持久化

上面的配置在重启后会丢失。我们需要让配置持久化。

4.1 Ubuntu/Debian 配置

编辑 /etc/network/interfaces 文件:

# /etc/network/interfaces# 物理网卡配置(根据实际情况修改)auto eth0iface eth0 inet staticaddress 203.0.113.10netmask 255.255.255.0gateway 203.0.113.1# 私网网卡配置auto eth1iface eth1 inet staticaddress 192.168.10.10netmask 255.255.255.0# IPIP 隧道配置auto tunl0iface tunl0 inet staticaddress 10.0.0.1netmask 255.255.255.252# 隧道端点配置tunnel-remote 203.0.113.20tunnel-local 203.0.113.10# MTU 配置mtu 1400# 开机自动启动up ip route add 192.168.20.0/24 via 10.0.0.2 dev tunl0down ip route del 192.168.20.0/24 via 10.0.0.2 dev tunl0

应用配置:

$ sudo ifdown tunl0 && sudo ifup tunl0

4.2 RHEL 配置

创建网络脚本/etc/sysconfig/network-scripts/ifcfg-tunl0

# /etc/sysconfig/network-scripts/ifcfg-tunl0DEVICE=tunl0NAME=tunl0BOOTPROTO=staticONBOOT=yesTYPE=GRETUNNEL_LOCAL=203.0.113.10TUNNEL_REMOTE=203.0.113.20MTU=1400IPADDR=10.0.0.1NETMASK=255.255.255.252

创建路由配置文件 /etc/sysconfig/network-scripts/route-tunl0

# /etc/sysconfig/network-scripts/route-tunl0192.168.20.0/24 via 10.0.0.2 dev tunl0

启动接口:

$ sudo ifup tunl0$ sudo systemctl restart network

4.3 使用 Netplan(Ubuntu 18.04+)

编辑 /etc/netplan/01-netcfg.yaml

network:  version: 2  renderer: networkd  ethernets:    eth0:      dhcp4: no      addresses:        - 203.0.113.10/24      routes:        - to: default          via: 203.0.113.1    eth1:      dhcp4: no      addresses:        - 192.168.10.10/24  tunnels:    tunl0:      mode: ipip      local203.0.113.10      remote: 203.0.113.20      addresses:        - 10.0.0.1/30      mtu: 1400      routes:        - to: 192.168.20.0/24          via: 10.0.0.2

应用配置:

$ sudo netplan apply

五、高级应用场景

5.1 站点到站点(Site-to-Site)连接

将两个不同地理位置的私有网络连接成一个大的局域网:

┌─────────────────────────────────────────────────────────────────────────┐│                      站点到站点 IPIP 隧道                                 ││                                                                          ││   ┌─────────────────┐                              ┌─────────────────┐  ││   │   北京总部       │                              │   上海分公司     │  ││   │                 │                              │                 │  ││   │  10.0.0.0/16    │                              │  10.1.0.0/16    │  ││   │       │         │                              │       │         │  ││   │       ▼         │                              │       ▼         │  ││   │   ┌─────────┐   │                              │   ┌─────────┐   │  ││   │   │ Gateway │   │                              │   │ Gateway │   │  ││   │   │  .0.1   │   │                              │   │  .1.1   │   │  ││   │   └────┬────┘   │                              │   └────┬────┘   │  ││   │        │        │                              │        │         │  ││   │  公网   │        │       IPIP 隧道              │        │  公网   │  ││   │   ◄────┴────►   │◄────────────────────────────►◄────────┴────►    │  ││   │   203.0.113.10  │                              │   203.0.113.20   │  ││   └─────────────────┘                              └─────────────────┘  ││                                                                          ││   配置命令(在两端的 Gateway 上执行):                                   ││                                                                          ││   # 北京端:                                                              ││   ip tunnel add tunl0 mode ipip remote 203.0.113.20 local 203.0.113.10  ││   ip link set tunl0 up                                                   ││   ip addr add 10.0.255.1/30 dev tunl0                                    ││   ip route add 10.1.0.0/16 via 10.0.255.2 dev tunl0                      ││                                                                          ││   # 上海端:                                                              ││   ip tunnel add tunl0 mode ipip remote 203.0.113.10 local 203.0.113.20  ││   ip link set tunl0 up                                                   ││   ip addr add 10.0.255.2/30 dev tunl0                                    ││   ip route add 10.0.0.0/16 via 10.0.255.1 dev tunl0                      ││                                                                          │└─────────────────────────────────────────────────────────────────────────┘

配置完成后,北京和上海的员工可以像在同一局域网一样互相访问。

5.2 跨云 VPC 互联

很多企业使用多云架构,IPIP 隧道可以帮助实现不同云 VPC 之间的互联:

# AWS VPC 配置(假设公网 IP 为 18.212.50.100)ip tunnel add cloud-tun mode ipip remote 203.0.113.20 local 18.212.50.100ip link set cloud-tun upip addr add 10.10.255.1/30 dev cloud-tunip route add 10.20.0.0/16 via 10.10.255.2 dev cloud-tun# 阿里云 VPC 配置(假设公网 IP 为 203.0.113.20)ip tunnel add cloud-tun mode ipip remote 18.212.50.100 local 203.0.113.20ip link set cloud-tun upip addr add 10.10.255.2/30 dev cloud-tunip route add 10.0.0.0/16 via 10.10.255.1 dev cloud-tun

5.3 多拨叠加带宽

在某些场景下,可以使用多条 IPIP 隧道实现带宽叠加:

# 创建多条隧道ip tunnel add tun0 mode ipip remote 203.0.113.20 local 203.0.113.10ip tunnel add tun1 mode ipip remote 203.0.113.21 local 203.0.113.11ip tunnel add tun2 mode ipip remote 203.0.113.22 local 203.0.113.12# 配置路由策略,实现负载均衡ip route add 192.168.20.0/24 \    nexthop via 10.0.0.2 dev tun0 \    nexthop via 10.0.1.2 dev tun1 \    nexthop via 10.0.2.2 dev tun2

六、与其他隧道技术的对比

IPIP 只是众多隧道技术中的一种。根据不同的场景,选择合适的隧道技术很重要。

特性

IPIP

GRE

VXLAN

IPSec

协议号

4

47

4789

50/51

层次

L3

L3

L2

L3

封装开销

20 字节

24 字节

50 字节

50+ 字节

加密

多播支持

非 IP 流量

配置复杂度

简单

中等

复杂

复杂

通用性

中等(容器网络)

中等

6.1 选择建议

  • 简单 L3 隧道
     → IPIP:开销最小,配置最简单
  • 需要支持多播或非 IP
     → GRE:支持多种协议类型
  • 容器网络 Overlay
     → VXLAN:专为数据中心设计
  • 需要加密
     → IPSec:提供端到端加密

七、常见问题与故障排除

7.1 隧道无法建立

症状:ping 不通对端隧道 IP

排查步骤:

# 1. 检查两端公网连通性ping 203.0.113.20# 2. 检查防火墙是否放行 Protocol 4sudo iptables -L -n -v | grep 4# 或sudo iptables -A INPUT -p 4 -j ACCEPTsudo iptables -A OUTPUT -p 4 -j ACCEPT# 3. 检查隧道接口状态ip tunnel showip link show tunl0# 4. 检查路由配置ip route show

7.2 MTU 导致的问题

症状:SSH 连接正常,但 scp 大文件失败;或某些网站能访问,某些不能访问

解决方案:

# 1. 调整隧道 MTUsudo ip link set tunl0 mtu 1400# 2. 同时调整服务器的整体 MTUsudo ip link set eth0 mtu 1400# 3. 在路由中设置 MTU(路径 MTU 发现可能失败)sudo ip route add 192.168.20.0/24 via 10.0.0.2 dev tunl0 mtu 1400# 4. 临时测试:降低客户端 MTUsudo ip link set eth0 mtu 1400

7.3 路由环路

症状:数据包在隧道中循环,无法到达目标

排查方法:

# 检查是否有错误的路由导致环路ip route showtraceroute 192.168.20.20# 常见原因:两台服务器都配置了默认路由通过隧道# 解决:只配置特定网段的路由,不要将默认路由指向隧道

7.4 防火墙配置

如果使用了 nftables 或 iptables,需要放行 IPIP 流量:

# iptables 放行 IPIPsudo iptables -I INPUT -p 4 -j ACCEPTsudo iptables -I OUTPUT -p 4 -j ACCEPT# nftables 放行 IPIPsudo nft add rule inet filter input ip protocol ipip acceptsudo nft add rule inet filter output ip protocol ipip accept

八、性能优化

8.1 启用硬件卸载

某些网卡支持隧道封装/解封装的硬件卸载:

# 检查是否支持ethtool -k eth0 | grep tunnel# 启用隧道卸载(如果支持)ethtool -K eth0 rx-tunnel offload on tx-tunnel offload on

8.2 调整缓冲区和队列

# 增加网络接口队列长度ip link set tunl0 txqueuelen 1000# 调整网卡的环形缓冲区ethtool -G eth0 rx 4096 tx 4096

8.3 使用多队列

在多核系统上,可以将隧道流量分配到不同的 CPU 核心:

# 查看当前 IRQ 亲和性cat /proc/interrupts | grep eth0# 将隧道相关的软中断绑定到特定 CPUecho 1 > /proc/irq/$(cat /proc/interrupts | grep eth0-rx-0 | awk '{print $1}')/smp_affinity

九、总结

IPIP 隧道是一种轻量级、易于配置的 L3 隧道技术,适用于以下场景:

  • 跨地域私有网络互联
    :将不同数据中心的私有网段连接起来
  • 云 VPC 互联
    :实现多云环境下的网络互通
  • 简单 VPN 替代
    :快速建立点对点加密通道(注意:IPIP 本身不加密)

核心要点回顾

  1. 原理
    :将原始 IP 数据包封装在新的 IP 头中传输,协议号 4
  2. 配置
    ip tunnel add 创建隧道,ip route 添加路由
  3. 关键参数
    :local(本地公网)、remote(远端公网)、MTU
  4. 常见问题
    :MTU 调整、防火墙放行协议 4
  5. 选择场景
    :简单 L3 互联选 IPIP,需要加密选 IPSec,需要 L2 选 VXLAN

最新文章

随机文章

基本 文件 流程 错误 SQL 调试
  1. 请求信息 : 2026-02-08 09:21:15 HTTP/2.0 GET : https://f.mffb.com.cn/a/464798.html
  2. 运行时间 : 0.127946s [ 吞吐率:7.82req/s ] 内存消耗:4,806.95kb 文件加载:140
  3. 缓存信息 : 0 reads,0 writes
  4. 会话信息 : SESSION_ID=eb98eb140e7e91635fdf46aa5b3a1f46
  1. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/public/index.php ( 0.79 KB )
  2. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/autoload.php ( 0.17 KB )
  3. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_real.php ( 2.49 KB )
  4. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/platform_check.php ( 0.90 KB )
  5. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/ClassLoader.php ( 14.03 KB )
  6. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/composer/autoload_static.php ( 4.90 KB )
  7. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper.php ( 8.34 KB )
  8. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/helper.php ( 2.19 KB )
  9. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/helper.php ( 1.47 KB )
  10. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/stubs/load_stubs.php ( 0.16 KB )
  11. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Exception.php ( 1.69 KB )
  12. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Facade.php ( 2.71 KB )
  13. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/deprecation-contracts/function.php ( 0.99 KB )
  14. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap.php ( 8.26 KB )
  15. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/polyfill-mbstring/bootstrap80.php ( 9.78 KB )
  16. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/Resources/functions/dump.php ( 1.49 KB )
  17. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-dumper/src/helper.php ( 0.18 KB )
  18. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/symfony/var-dumper/VarDumper.php ( 4.30 KB )
  19. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/App.php ( 15.30 KB )
  20. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-container/src/Container.php ( 15.76 KB )
  21. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/container/src/ContainerInterface.php ( 1.02 KB )
  22. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/provider.php ( 0.19 KB )
  23. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Http.php ( 6.04 KB )
  24. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Str.php ( 7.29 KB )
  25. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Env.php ( 4.68 KB )
  26. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/common.php ( 0.03 KB )
  27. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/helper.php ( 18.78 KB )
  28. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Config.php ( 5.54 KB )
  29. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/app.php ( 0.95 KB )
  30. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cache.php ( 0.78 KB )
  31. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/console.php ( 0.23 KB )
  32. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/cookie.php ( 0.56 KB )
  33. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/database.php ( 2.48 KB )
  34. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Env.php ( 1.67 KB )
  35. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/filesystem.php ( 0.61 KB )
  36. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/lang.php ( 0.91 KB )
  37. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/log.php ( 1.35 KB )
  38. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/middleware.php ( 0.19 KB )
  39. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/route.php ( 1.89 KB )
  40. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/session.php ( 0.57 KB )
  41. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/trace.php ( 0.34 KB )
  42. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/config/view.php ( 0.82 KB )
  43. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/event.php ( 0.25 KB )
  44. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Event.php ( 7.67 KB )
  45. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/service.php ( 0.13 KB )
  46. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/AppService.php ( 0.26 KB )
  47. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Service.php ( 1.64 KB )
  48. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Lang.php ( 7.35 KB )
  49. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/lang/zh-cn.php ( 13.70 KB )
  50. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/Error.php ( 3.31 KB )
  51. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/RegisterService.php ( 1.33 KB )
  52. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/services.php ( 0.14 KB )
  53. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/PaginatorService.php ( 1.52 KB )
  54. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ValidateService.php ( 0.99 KB )
  55. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/service/ModelService.php ( 2.04 KB )
  56. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Service.php ( 0.77 KB )
  57. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Middleware.php ( 6.72 KB )
  58. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/initializer/BootService.php ( 0.77 KB )
  59. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Paginator.php ( 11.86 KB )
  60. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-validate/src/Validate.php ( 63.20 KB )
  61. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/Model.php ( 23.55 KB )
  62. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Attribute.php ( 21.05 KB )
  63. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/AutoWriteData.php ( 4.21 KB )
  64. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/Conversion.php ( 6.44 KB )
  65. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/DbConnect.php ( 5.16 KB )
  66. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/ModelEvent.php ( 2.33 KB )
  67. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/concern/RelationShip.php ( 28.29 KB )
  68. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Arrayable.php ( 0.09 KB )
  69. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/contract/Jsonable.php ( 0.13 KB )
  70. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/model/contract/Modelable.php ( 0.09 KB )
  71. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Db.php ( 2.88 KB )
  72. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/DbManager.php ( 8.52 KB )
  73. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Log.php ( 6.28 KB )
  74. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Manager.php ( 3.92 KB )
  75. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerTrait.php ( 2.69 KB )
  76. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/log/src/LoggerInterface.php ( 2.71 KB )
  77. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cache.php ( 4.92 KB )
  78. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/psr/simple-cache/src/CacheInterface.php ( 4.71 KB )
  79. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/helper/Arr.php ( 16.63 KB )
  80. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/driver/File.php ( 7.84 KB )
  81. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/cache/Driver.php ( 9.03 KB )
  82. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/CacheHandlerInterface.php ( 1.99 KB )
  83. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/Request.php ( 0.09 KB )
  84. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Request.php ( 55.78 KB )
  85. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/middleware.php ( 0.25 KB )
  86. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Pipeline.php ( 2.61 KB )
  87. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/TraceDebug.php ( 3.40 KB )
  88. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/middleware/SessionInit.php ( 1.94 KB )
  89. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Session.php ( 1.80 KB )
  90. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/driver/File.php ( 6.27 KB )
  91. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/SessionHandlerInterface.php ( 0.87 KB )
  92. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/session/Store.php ( 7.12 KB )
  93. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Route.php ( 23.73 KB )
  94. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleName.php ( 5.75 KB )
  95. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Domain.php ( 2.53 KB )
  96. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleGroup.php ( 22.43 KB )
  97. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Rule.php ( 26.95 KB )
  98. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/RuleItem.php ( 9.78 KB )
  99. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/route/app.php ( 1.72 KB )
  100. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/Route.php ( 4.70 KB )
  101. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/dispatch/Controller.php ( 4.74 KB )
  102. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/route/Dispatch.php ( 10.44 KB )
  103. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/controller/Index.php ( 4.81 KB )
  104. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/app/BaseController.php ( 2.05 KB )
  105. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/facade/Db.php ( 0.93 KB )
  106. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/connector/Mysql.php ( 5.44 KB )
  107. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/PDOConnection.php ( 52.47 KB )
  108. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Connection.php ( 8.39 KB )
  109. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/ConnectionInterface.php ( 4.57 KB )
  110. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/builder/Mysql.php ( 16.58 KB )
  111. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Builder.php ( 24.06 KB )
  112. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseBuilder.php ( 27.50 KB )
  113. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/Query.php ( 15.71 KB )
  114. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/BaseQuery.php ( 45.13 KB )
  115. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TimeFieldQuery.php ( 7.43 KB )
  116. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/AggregateQuery.php ( 3.26 KB )
  117. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ModelRelationQuery.php ( 20.07 KB )
  118. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ParamsBind.php ( 3.66 KB )
  119. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/ResultOperation.php ( 7.01 KB )
  120. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/WhereQuery.php ( 19.37 KB )
  121. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/JoinAndViewQuery.php ( 7.11 KB )
  122. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/TableFieldInfo.php ( 2.63 KB )
  123. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-orm/src/db/concern/Transaction.php ( 2.77 KB )
  124. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/driver/File.php ( 5.96 KB )
  125. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/LogHandlerInterface.php ( 0.86 KB )
  126. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/log/Channel.php ( 3.89 KB )
  127. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/event/LogRecord.php ( 1.02 KB )
  128. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-helper/src/Collection.php ( 16.47 KB )
  129. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/facade/View.php ( 1.70 KB )
  130. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/View.php ( 4.39 KB )
  131. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Response.php ( 8.81 KB )
  132. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/response/View.php ( 3.29 KB )
  133. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/Cookie.php ( 6.06 KB )
  134. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-view/src/Think.php ( 8.38 KB )
  135. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/framework/src/think/contract/TemplateHandlerInterface.php ( 1.60 KB )
  136. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/Template.php ( 46.61 KB )
  137. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/driver/File.php ( 2.41 KB )
  138. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-template/src/template/contract/DriverInterface.php ( 0.86 KB )
  139. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/runtime/temp/067d451b9a0c665040f3f1bdd3293d68.php ( 11.98 KB )
  140. /yingpanguazai/ssd/ssd1/www/f.mffb.com.cn/vendor/topthink/think-trace/src/Html.php ( 4.42 KB )
  1. CONNECT:[ UseTime:0.000538s ] mysql:host=127.0.0.1;port=3306;dbname=f_mffb;charset=utf8mb4
  2. SHOW FULL COLUMNS FROM `fenlei` [ RunTime:0.000782s ]
  3. SELECT * FROM `fenlei` WHERE `fid` = 0 [ RunTime:0.001269s ]
  4. SELECT * FROM `fenlei` WHERE `fid` = 63 [ RunTime:0.002170s ]
  5. SHOW FULL COLUMNS FROM `set` [ RunTime:0.000501s ]
  6. SELECT * FROM `set` [ RunTime:0.000216s ]
  7. SHOW FULL COLUMNS FROM `article` [ RunTime:0.000501s ]
  8. SELECT * FROM `article` WHERE `id` = 464798 LIMIT 1 [ RunTime:0.003960s ]
  9. UPDATE `article` SET `lasttime` = 1770513676 WHERE `id` = 464798 [ RunTime:0.007788s ]
  10. SELECT * FROM `fenlei` WHERE `id` = 67 LIMIT 1 [ RunTime:0.000647s ]
  11. SELECT * FROM `article` WHERE `id` < 464798 ORDER BY `id` DESC LIMIT 1 [ RunTime:0.000740s ]
  12. SELECT * FROM `article` WHERE `id` > 464798 ORDER BY `id` ASC LIMIT 1 [ RunTime:0.000517s ]
  13. SELECT * FROM `article` WHERE `id` < 464798 ORDER BY `id` DESC LIMIT 10 [ RunTime:0.006689s ]
  14. SELECT * FROM `article` WHERE `id` < 464798 ORDER BY `id` DESC LIMIT 10,10 [ RunTime:0.007445s ]
  15. SELECT * FROM `article` WHERE `id` < 464798 ORDER BY `id` DESC LIMIT 20,10 [ RunTime:0.026907s ]
0.129523s