Skip to content

Instantly share code, notes, and snippets.

@huangguozhen
Created October 11, 2016 02:08
Show Gist options
  • Save huangguozhen/e7d9fc111199d939f18cc56de5162bd7 to your computer and use it in GitHub Desktop.
Save huangguozhen/e7d9fc111199d939f18cc56de5162bd7 to your computer and use it in GitHub Desktop.
Ubuntu 安装
```
$ apt-get install rinetd
```
源码安装
```
$ wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
$ tar zxvf rinetd.tar.gz && cd rinetd
$ mkdir -p /usr/man/man8
$ make && make install
```
配置rinetd.conf
格式
---
[BindAddress]: 绑定地址
[BindPort]: 绑定端口
[ConnectAddress]: 连接地址
[ConnectPort]: 连接端口
---
---
[Source Address]: 源地址
[Source Port]: 源端口
[Destination Address]: 目的地址
[Destination Port]: 目的端口
---
配置规则
```
$ vim /etc/rinetd.conf
0.0.0.0 8080 172.19.94.3 8080 #将所有发往本机8080端口的请求转发到172.19.94.3 8080端口
0.0.0.0 2222 172.19.94.3 3389 #将所有发往本机2222端口的请求转发到172.19.94.3 3389端口
1.2.3.4 80 192.168.0.10 80 #将所有发往1.2.3.4 80端口的请求转发到192.168.0.10 80端口
allow *.*.*.* #设置允许访问的IP地址信息
logfile /var/log/rinetd.log #设置打印log的位置
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment