在工作中使用了种NAT工具,我发现在Linux下使用Rinted工具非常便捷好用,先把安装步骤简单写一下,方便记忆。
[root@zhenyunode zhenyutest]# cd ~/zhenyutest/
[root@zhenyunode zhenyutest]# wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
[root@zhenyunode zhenyutest]# tar -xvf ~/zhenyutest/rinetd.tar.gz
[root@zhenyunode zhenyutest]# cd ~/zhenyutest/rinetd/
[root@zhenyunode rinetd]# sed -i 's/65536/65535/g' rinetd.c
[root@zhenyunode rinetd]# mkdir /usr/man/
[root@zhenyunode rinetd]# make && make install
[root@zhenyunode rinetd]#
下面是配置实例:
0.0.0.0 40001 10.0.0.3 9182
0.0.0.0 40002 10.0.0.4 9182
0.0.0.0 40003 10.0.0.5 9182
0.0.0.0 40005 10.0.0.11 9182
0.0.0.0 40006 10.0.0.12 9182
0.0.0.0 40007 10.0.0.13 9182
0.0.0.0 40008 10.0.0.14 9182
配置文件格式很简单:[Source Address] [Source Port] [Destination Address] [Destination Port]
启动:
[root@zhenyunode rinetd]# rinetd -c /etc/rinetd.conf
[root@zhenyunode ~]# ps -ef | grep rinetd
root 27346 27300 0 12:34 pts/1 00:00:00 grep --color=auto rinetd
root 32186 1 0 5月16 ? 00:00:00 rinetd -c /etc/rinetd.conf
停止:
[root@zhenyunode rinetd]# killall rinetd
root@zhenyunode rinetd]# netstat -tanulp|grep rinetd
tcp 0 0 0.0.0.0:8080 0.0.0.0:* LISTEN 32186/rinetd