从LAN上的客户端远程访问 [英] Remote access from a client on LAN

查看:58
本文介绍了从LAN上的客户端远程访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好


我正在开发一个需要PostgreSQL连接的应用程序,我已经在我的开发机器上安装了PostgreSQL并使用NpgSQL连接到数据库。当应用程序在开发PC上运行时,我能够连接到数据库,但是当我在网络上的任何其他PC上时,我无法将应用程序连接到在另一台机器上运行的数据库服务器。我一直在寻找解决方案很长一段时间,但似乎没有任何工作。


我尝试编辑配置文件{pg_hba.conf和postgresql.conf}以下页面中描述的设置:

http://www.cyberciti.biz/tips/postgr...onnection.html

pg_hba.conf:

我已经插入了以下行,就在默认环回主机字符串下面(主机全部都是27.0.0.0/32 md5):

主机所有192.168.0.0/24信任


我也尝试了上面字符串的组合,比如使用md5而不是trust,并提供远程机器的实际IP地址等等,但没有运气。像往常一样你也必须对其他配置文件进行更改,见下文


postgresql.conf:

我取消注释listen_addresses ='' localhost''并将localhost更改为''*'':

listen_addresses =''*''


似乎什么都没有用,我真的很感激如果有人能把我放在正确的方向所有方框的详细信息如下:


开发者机器:Windows XP PostgreSQL 8.XX安装

其他PC:Windows XP没有安装Postgresql
其他电脑:Vista Home P没有安装Postgresql


我尝试了很多东西,例如关闭防火墙等等,但似乎没有任何工作。


注意:我可以在安装了PostgreSQL的电脑上打开和关闭防火墙。


提前谢谢。

Hello

I am developing an application that requires PostgreSQL connection, I have installed PostgreSQL on my development machine and using NpgSQL to connect to the database. I am able to connect to the database while the application is running on the development PC, but whenever I am on any other PC on my network I cannot connect the application to the DB server running on another machine. I have been searching for a solution for quite a long time now, but nothing seems to be working.

I have tried editing the config files {pg_hba.conf and postgresql.conf} with the settings described in the following page:

http://www.cyberciti.biz/tips/postgr...onnection.html

pg_hba.conf:
I have inserted the following lines, just underneath the default loopback host string (host all all 27.0.0.0/32 md5):
host all all 192.168.0.0/24 trust

I have also tried a combination of things on the above string such as using md5 instead of trust and providing the actual ip address of the remote machine and so on, but no luck. As usual you would have to make changes to the other config file as well, see below

postgresql.conf:
I have uncommented the listen_addresses=''localhost'' and changed localhost to ''*'':
listen_addresses=''*''

Nothing seems to be working, I would really appreciate if someone could put me in the right direction. Details on all the boxes are given below:

Developer machine: Windows XP PostgreSQL 8.XX installed
Other PC: Windows XP NO Postgresql installed
Other PC: Vista Home P with NO Postgresql installed

I have tried many things, such as turning the firewall off and so on, but nothing seems to be working.

NOTE: I am able to ping the PC with PostgreSQL installed both with Firewall on and off.

Thanks in advance.

推荐答案

尝试连接数据库时的答案是什么?
What is the answer when you try to connect to db?


你好,


感谢阅读帖子,我找到了问题的原因。实际上这是由于防火墙,虽然我插入了一条规则,允许客户端PC与数据库服务器连接到PC,但它缺少端口访问。此外,Windows防火墙与COMODO防火墙一起运行,禁用Windows防火墙并将端口详细信息应用到为我工作的防火墙。


为了帮助其他人遇到类似问题,以下是详细信息用于PostgreSQL配置文件:


pg_hba.conf:

主机全部27.0.0.0/32 md5

主机全部全部0.0.0.0/0 md5

postgresql.conf:

listen_addresses =''*''



然后重启服务器,就这么简单。


谢谢
Hello,

Thanks for reading the post, I have managed to find the cause of the problem. Actually it was due to the firewall, although I inserted a rule to allow the Client PC to connect to the PC with the DB Server, but it was missing the port access. Also Windows Firewall was running together with the COMODO Firewall, disabling Windows Firewall and applying the port details to the firewall worked for me.

To help others having similar issues, here are the details I used in the PostgreSQL config file:

pg_hba.conf:
host all all 27.0.0.0/32 md5
host all all 0.0.0.0/0 md5

postgresql.conf:
listen_addresses=''*''


and restart the server, simple as that.

Thanks


你好Harvindersingh先生,


阅读你的帖子后我感到很开心。因为我还需要实现从LAN上的客户端远程访问功能。为此,我已经使用了搜索引擎很长时间,并按照上面提到的步骤。但我没有得到任何解决方案。希望你在这个问题上取得成功。请让我知道如何实现此功能的步骤。这对我很有帮助。


非常感谢。
Hello Mr Harvindersingh,

I feel happy after reading your post. beacuse i m also need to implement the feature "Remote access from a client on LAN". For this i have use search engine for a long time and followed the steps what you have mentioned above. But i did not get any solution. Hope you have succeded on this issue. Please let me know the steps that how can implement this feature. It will be helpful to me.

Many Thanks.


这篇关于从LAN上的客户端远程访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆