基于linux的防火墙设计.docx
I 中文摘要 在科技不断发展的今天,人们的生活与互联网的关系越来越紧密,但是网络安全 问题也越来越严重。防火墙在一定程度上可以保护计算机和互联网安全,避免可能的 损失。 本文主要研究了基于 Linux 内核防火墙 Netfilter 系统的结构框架特点、工作原理及 其在内核中的实现机制;Linux 内核模块的开发。 论文介绍了一个简单的包过滤防火墙的设计过程。本系统在 Netfilter 上进行二次 开发,设计了一个内核模块,通过动态加载到内核中实现对数据包的过滤功能,具有 很高的效率,数据包处理能力较强。Netfilter 框架的使用使其具有良好的代码结构,易 于维护和扩展。防火墙架设在 Linux 系统上,连接内部网络和外部网络。该防火墙主要 实现了以下功能用户配置;基于 IP 地址的过滤;针对 TCP/UDP 协议端口的过滤;日 志记录。 关键词网络安全;防火墙;Linux内核;NetfilterII Simple Firewall based on Linux Author Tutor Wu Yan Abstract Nowadays, as technology is developing increasingly, the relationship between people’s ordinary life and Internet has become closer and closer. Meanwhile, internet security becomes more and more serious. Firewall is able to protect computer and network in general level from attacking via network. This paper mainly studies the framework, theory and implementation mechanisms in kernel of the Linux firewall named Netfilter, Linux kernel module development. The system designs a simple packet filtering firewall. The firewall system is the second development based on Netfilter. The firewall is a kernel module which is dynamic loaded into the kernel to realize the packet filtering, whick has high efficiency and strong ability of dealing with data packages. It has good code structure, is easy to maintain and extend because of using of Netfilter framework. The firewall is set up on the Linux server, connects the internal network and the external network. The main functions of the firewall includes user configuration; IP address filtering; TCP/UDP port filtering; log recording. Keywords network security;firewall;Linux kernel;NetfilterIII 目 录 第一章 系统概述......................................................................1 1.1 课题研究的背景...............................................................1 1.1.1 网络的不安全性.........................................................1 1.1.2 网络安全需要防火墙保护.................................................1 1.2 课题研究的意义...............................................................1 1.3 选题的目的...................................................................2 第二章 防火墙的功能需求..............................................................3 2.1 功能描述.....................................................................3 2.2 需求分析.....................................................................4 2.2.1 防火墙的条件和动作.....................................................4 2.2.2 防火墙支持的过滤类型和内容.............................................5 2.2.3 防火墙过滤的方式和动作.................................................6 2.2.4 防火墙的配置文件.......................................................7 2.2.5 防火墙命令行配置格式...................................................7 2.2.6 防火墙的规则文件格式...................................................8 2.2.7 防火墙的日志文件数据格式...............................................9 2.2.8 防火墙构建所采用的技术方案.............................................9 第三章 所采用的技术介绍.............................................................11 3.1 使用netlink进行用户空间和内核空间数据交互.........................