捣鼓了好几天终于解决Xdmcp连接失败问题, 把答案贴在这儿供参考:

首先,先贴下网上找到的检查步骤:

1、是否有dtlogin,KDM,GDM或XDM程序在远程主机上运行? 2、远程主机上是否显示登录窗口? 3、远程主机是否使用的是另一个网络? 4、远程主机跟用户电脑之间是否有防火墙? 5、用户电脑中是否设置了防火墙? 6、名称服务器中保存的用户地址是否是错误的? 7、你的shell脚本(比如/etc/profile之类)中是否配置了错误的DISPLAY变量值。

英文版:

1.Check the following: ★Is a dtlogin, kdm, gdm or xdm is running on the remote host? ★Does the login window open? ★Is the remote host on a different network? ★Is there a firewall between your Windows and the remote host? ★Does your Windows system have a firewall configuration? ★The name server may have an incorrect entry for your PC. ★The DISPLAY variable is configured incorrectly on your shell script.

2.See log messages. ★To see Xmanager log files, click the system menu on Xmanager main window, point to Log, and then click File. ★For CDE errors, read /var/dt/Xerrors when you cannot see the login window. Read $HOME/.dt/startlog and $HOME/.dt/errorlog when you failed to login.

To solve Xstart connection problems: 1.Run Xstart. 2.Select Show status dialog box. 3.Select Show reply messages. 4.Click Run. RESULT: A Reply Messages dialog box opens. 5.Read the reply messages to find the reason of the problem.

说明

  • 要知道是否有dtlogin,KDM,GDM或XDM程序在远程主机上运行, 请用root账号查看gdm是否在177端口等待 netstat -tulnp | grep 177 看到udp和udp6表示gdm启动成功

  • 你的Windows上有没有server在6000端口等待?
    netstat -aon | findstr 6000 看到0.0.0.0:6000 表示windows上的xserver启动成功 一般xserver是xdmcp的client端启动的,我用的是mobaxterm,它自动启动xserver。

  • 到此,若xdmcp仍连线失败,多半是网络问题, 即linux透过网络找不到你的主机

一般有以下两种情况

1.windows或linux或两者之间有防火墙,把他们全关掉 2.linux无法透过你的主机名来连你

以下列三方法解决:

一、Windows的网卡ip要单纯,

1.千万不要有多网卡,尤其要禁用vmware的虚拟网卡(** 重要、重要 **); 2.确定跟linux在同一网段 3.网卡中不要有多个ip,如果有多个请删掉其他留下一个;

二、关闭Windows和Linux两端的防火墙

注意,linux上的防火墙除iptables,firewall外,还有SE Linux

  • Linux端不可以开启“SE Linux”,如果开启,请关闭它 /usr/sbin/sestatus命令可以查SE的状态,如果SELinux status: enabled表示他是开启的
  • 临时关闭:setenforce 0
  • 永久关闭:将/etc/selinux/config文件中的SELINUX=enforcing改为SELINUX=disabled

三、用who命令看看linux认为你的主机叫什么,如果不是ip,则在linux的/etc/hosts添加:

  • 你的主机ip 你的主机名(即who上那个主机名)
  • 从linux ping windows (用ip和名字都ping一次)看看是否能够正确的从linux找到你的windows

另外:

  • Server端日志位置:/var/log/lightdm/.log 或 /var/log/gdm/.log