实验环境:
mysql:192.168.6.90 3306
xinetd:192.168.6.91 9001
实验目的:
通过访问 192.168.6.91:9001 连接 192.168.6.90:3306 数据库
在 192.168.6.91配置
#安装xinetd yum -y install xinetd* #设置开机自启 systemctl enable xinetd.service
建立要转发的配置文件:
vim /etc/xinetd.d/mysql service mysql {
per_source = UNLIMITED
instances = UNLIMITED #这两行为去掉连接limit限制
disable = no type = UNLISTED socket_type = stream protocol = tcp wait = no redirect = 192.168.6.90 3306 bind = 0.0.0.0 only_from = 192.168.6.0/24 192.168.10.235 192.168.5.159 port = 9001 user = root flags = NODELAY KEEPALIVE NOLIBWRAP IPv4 log_type = FILE /var/log/mysql-test.log cps = 100 30 }
启动xinetd服务
systemctl restart xinetd.service