---
title: "Discussion on \"简单的路由表查找程序\" | Hashnode"
description: "Discussion on \"简单的路由表查找程序\". 在Linux操作系统中，内核中有一个路由表，它包含若干条路由记录，这些记录由子网IP、子网掩码、网关IP和接口名等组成，这些信息用于将数据包转发到其他子网或者连接到互联网；本文介绍了当需要转发数据包时，Linux内核查找路由表的基本算法，并用程序模拟了这个过程，附有完整的源代码。本文对网络编程的初学者难度不大。\n当我们在Linux系统下发送一个报文时，Linux需要确定路由，也就是将这个报文转发到哪个网络接口下的哪个设备上去，一个连接在网络上的Linux系统至少有两个网络接口，一个是网卡(有线或..."
url: "https://hashnode.com/posts/180016-longest-prefix-match/63e9dc5e12b983cbaaa58a62"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [简单的路由表查找程序](https://whowin.cn/180016-longest-prefix-match?utm_source=hashnode&utm_medium=feed)

在Linux操作系统中，内核中有一个路由表，它包含若干条路由记录，这些记录由子网IP、子网掩码、网关IP和接口名等组成，这些信息用于将数据包转发到其他子网或者连接到互联网；本文介绍了当需要转发数据包时，Linux内核查找路由表的基本算法，并用程序模拟了这个过程，附有完整的源代码。本文对网络编程的初学者难度不大。 当我们在Linux系统下发送一个报文时，Linux需要确定路由，也就是将这个报文转发到哪个网络接口下的哪个设备上去，一个连接在网络上的Linux系统至少有两个网络接口，一个是网卡(有线或...

Feb 10, 2023 · 2 min read · whowin.cn  
Updated Oct 17, 2024  
Read the article

-   [#linux](https://hashnode.com/tag/linux)
-   [#routing](https://hashnode.com/tag/routing)
-   [#longest-prefix-match](https://hashnode.com/tag/longest-prefix-match)
-   [#fiblookup](https://hashnode.com/tag/fiblookup)

## Written by

[whowin](https://hashnode.com/@whowin)

@whowin · Beijing, China

  
[View profile](https://hashnode.com/@whowin)

一枚有30多年经验的退休程序员，主要从事嵌入式软件开发

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
