1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
[root@PortForward02 src]
# wget http://www.boutell.com/rinetd/http/rinetd.tar.gz
[root@PortForward02 src]
# ls
rinetd.
tar
.gz
[root@PortForward02 src]
# tar -zxvf rinetd.tar.gz
[root@PortForward02 src]
# cd rinetd
[root@PortForward02 rinetd]
# make
cc -DLINUX -g -c -o rinetd.o rinetd.c
rinetd.c:176: warning: conflicting types
for
built-
in
function
‘log’
cc -DLINUX -g -c -o match.o match.c
gcc rinetd.o match.o -o rinetd
[root@PortForward02 rinetd]
# make install
install
-m 700 rinetd
/usr/sbin
install
-m 644 rinetd.8
/usr/man/man8
install
: cannot create regular
file
`
/usr/man/man8
': No such
file
or directory
make
: *** [
install
] Error 1
[root@PortForward02 rinetd]
#
|
1
2
3
4
5
|
[root@PortForward02 rinetd]
# vim rinetd.c
544
if
((bindPort == 0) || (bindPort >= 65535)) {
567
if
((connectPort == 0) || (connectPort >= 65535)) {
或者
[root@localhost rinetd]
# sed -i "s/35536/35535/g" rinetd.c
|
1
2
3
4
5
6
7
8
9
10
11
|
[root@PortForward02 rinetd]
# mkdir -p /usr/man/
[root@PortForward02 rinetd]
# make clean
[root@localhost rinetd]
# make
cc -DLINUX -g -c -o rinetd.o rinetd.c
rinetd.c:176: warning: conflicting types
for
built-
in
function
‘log’
cc -DLINUX -g -c -o match.o match.c
gcc rinetd.o match.o -o rinetd
[root@localhost rinetd]
# make install
install
-m 700 rinetd
/usr/sbin
install
-m 644 rinetd.8
/usr/man/man8
[root@localhost rinetd]
#
|
1
2
3
4
5
6
7
|
[root@localhost rinetd]
# vim /etc/rinetd.conf
allow 10.15.44.162
//
设置允许访问的ip地址信息
# allow 0.0.0.0
#allow 10.15.44.*
#deny 10.15.44.144
0.0.0.0 8090 10.15.44.133 80
//
设置端口转发
logfile
/var/log/rinetd
.log
//
设置打印的log
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
[root@PortForward02 rinetd]
# /usr/sbin/rinetd
或者
[root@localhost rinetd]
# rinetd -c /etc/rinetd.conf
[root@localhost rinetd]
# netstat -antulp|grep -i rinetd
tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 5849
/rinetd
[root@localhost rinetd]
# killall -9 rinetd 或者pkill -9 rinetd
[root@localhost rinetd]
# netstat -antulp|grep -i rinetd
[root@localhost rinetd]
# rinetd
[root@localhost rinetd]
# netstat -antulp|grep -i rinetd
tcp 0 0 0.0.0.0:8090 0.0.0.0:* LISTEN 5861
/rinetd
[root@PortForward02 rinetd]
# cat /etc/rc.d/rc.local |grep -v "#"
/usr/sbin/rinetd
-c
/etc/rinetd
.conf
touch
/var/lock/subsys/local
[root@PortForward02 rinetd]
#
|
1
|
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 2222 -j ACCEPT
|
1
2
3
|
wget –no-cache http:
//www
.convirture.com
/repos/definitions/rhel/6
.x
/convirt
.repo -O
/etc/yum
.repos.d
/convirt
.repo
yum makecache
yum
install
socat
|
1
2
|
nohup
socat tcp-l:外部访问端口,reuseaddr,fork tcp:192.168.xxx.xxx:内部转发端口
nohup
socat TCP4-LISTEN:188,reuseaddr,fork TCP4:192.168.1.22:123 &
|