利用Linux构建一台千兆级的NAT服务器

Ippen Yang
(ippen@21cn.com)

1.前言
本文档主要描述如何利用Linux构建一台能力强大的NAT服务器,并发连接数高达50万或更高(最高曾经有70万),流量1GB,系统稳定。这个方案适合动手能力强的朋友。

2.许可协议
本文的许可协议遵循GNU Free Document License。协议的具体内容请参见。在遵循GNU Free Document License的基础上,可以自由地转载或发行本文,但请保留本文的完整性。

3.准备工作
CentOS 4.6光盘一套(4张CD)
kernel-2.6.28.9内核源码
PC服务器一台,4核 CPU,速度越快越好,2G或以上的硬盘(可以用CF电子盘),两个高性能PCI-E千兆网卡(一定要Intel PCI-E的网卡),
参考硬件配置:Intel S3200,512M内存*2,Q6600 CPU,80G硬盘,Intel千兆网卡

4.安装
首先安装CentOS,安装时记住要安装开发工具,因为要编译内核;安装时不要建立交换区,切记!!
安装完成后,运行setup,在system service中将不需要用的程序全部停止,基本上只需要保留ssh,iptables,network,snmpd,syslog几个,设置完后重新启动服务器。
将kernel文件解压到/usr/src中,然后运行 make menuconfig,配置内核编译参数,基本上不用改什么参数,注意要选择多CPU,选择netfilter中的参数,指定你需要编译的模块,然后执行make编译内核,make modules_install 安装内核模块,make install 安装内核
编辑/etc/grub.conf


#boot=/dev/sda1
default=0
timeout=1
#splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.28.9)
        root (hd0,2)
       kernel /boot/vmlinuz-2.6.28.9 ro root=LABEL=/
        initrd /boot/initrd-2.6.28.9.img
title CentOS-4 i386 (2.6.9-34.ELsmp)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-34.ELsmp ro root=LABEL=/
        initrd /boot/initrd-2.6.9-34.ELsmp.img
title CentOS-4 i386-up (2.6.9-34.EL)
        root (hd0,0)
        kernel /boot/vmlinuz-2.6.9-34.EL ro root=LABEL=/
        initrd /boot/initrd-2.6.9-34.EL.img
将服务器调整使用2.6.28.9内核启动

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wyjsdg.html