LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Closed Thread
 
Search this Thread
Old 04-15-2009, 02:44 PM   #1
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit), USA
Distribution: Centos 5 Under VMware in WinXP CentOS 5.3 all under VMware
Posts: 418

Rep: Reputation: 33
How to open a port on a Centos 5 server


I would like to use tightvnc to connect from my windows xp box to the centos 5 box.

How do I check to see if ports 5800 and 5900 are open and if not how can I open them so I can connect from windows to centos.

Thanks
 
Old 04-15-2009, 03:12 PM   #2
MensaWater
Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 6,015
Blog Entries: 5

Rep: Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787Reputation: 787
There are really 2 questions here:
1) Is anything LISTENING on the ports you mention? You can find that out with "lsof -i :<portno>"

2) The other is the one you asked. CentOS by default uses iptables as a firewall and by default only allows outbound traffic.
You can run "iptables -L" to see if it is on or off.

If it is "off" then you'll usually only see 3 items in the list such as:
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

If it is "on" you'll see a lot more output like:
Chain INPUT (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain FORWARD (policy ACCEPT)
target prot opt source destination
RH-Firewall-1-INPUT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain RH-Firewall-1-INPUT (2 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited

You can stop iptables by running: service iptables stop
You can start it by running: service iptables start.

I'd suggest stopping iptables then starting the vnc service and do the lsof check I mentioned. Then do your attempt to attach from XP. If it works then restart iptables and check again.

You can add the ports to iptables generally by following this procedure:

First verify iptables is running with iptables -L and that its last entry is to vlock icmp.

1) iptables -D RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
### Deletes the icmp rule

2) iptables -A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport
5800 -j ACCEPT
### Opens TCP port 5800 for inbound connections.

3) iptables -A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport
5900 -j ACCEPT
### Opens TCP port 5900 for inbound connections.

4) iptables -A RH-Firewall-1-INPUT -j REJECT --reject-with icmp-host-prohibited
### Readds the icmp rule as last rule.

5) iptables-save >/etc/sysconfig/iptables
### Saves to file read on iptables start.

Also you probably want to add port 5800 and 5900 to /etc/services file if they're not already there.
 
Old 04-16-2009, 04:37 AM   #3
maresmasb
Member
 
Registered: Apr 2009
Posts: 108

Rep: Reputation: 24
Just one additional note: You are running a virtual CentOS via VMware on a Windows box, so make sure that you have the VMware network settings work correctly to access the virtual system from your host, before trying to hunt down a problem in CentOS that happens outside of it.
 
Old 04-16-2009, 06:08 AM   #4
pg99
Member
 
Registered: May 2008
Location: UK
Distribution: Slackware
Posts: 73

Rep: Reputation: 18
Or if you have the gnome gui on your server you can use

System > Administration > Security Level and Firewall

to open the ports, followed by

System > Administration > Server Settings > Services

to restart the firewall
 
Old 04-16-2009, 07:43 AM   #5
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
If you can SSH to the server, use an SSH tunnel, bypasses the firewall but keeps things more secure and locked up, also gets around certain weaknesses in VNC. For example, all VNC sessions use a different port for each session, so you would need to open/close the ports as needed by vnc-server for the vnc sessions to be connectable, the other thing to think about is if your vnc sessions are encrypted or not.

Last edited by r3sistance; 04-16-2009 at 07:45 AM.
 
Old 04-16-2009, 04:21 PM   #6
swamprat
Member
 
Registered: Sep 2005
Location: New Jersey, (Which Exit), USA
Distribution: Centos 5 Under VMware in WinXP CentOS 5.3 all under VMware
Posts: 418

Original Poster
Rep: Reputation: 33
Thanks SSH is fine but we want to use the KDE screens.
 
Old 04-16-2009, 05:17 PM   #7
r3sistance
Senior Member
 
Registered: Mar 2004
Location: UK
Distribution: CentOS 5.4, Mac OS 10.4 (tiger)
Posts: 1,005

Rep: Reputation: 79
Assuming KDE is already installed, open up the file ~/.vnc/xstartup in a text editor for the user that the vnc session relates to and change the last line from something like... "vmx &" to "startkde &" (it should be the last line anyway, you can always put startkde & on a new line underneath). Restart the VNC session, if your VNC connection brought up a terminal, type startkde in it to test that kde works.
 
Old 04-16-2009, 05:54 PM   #8
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,986
Blog Entries: 11

Rep: Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880Reputation: 880
Please post your thread in only one forum. Posting a single thread in the most relevant forum will make it easier for members to help you and will keep the discussion in one place. This thread is being closed because it is a duplicate.

https://www.linuxquestions.org/quest...-winxp-719183/

Btw ... you've been on LQ for long enough to know better, eh?

Last edited by Tinkster; 04-16-2009 at 05:57 PM.
 
  


Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: CentOS Directory Server On CentOS 5.2 LXer Syndicated Linux News 0 08-06-2008 09:20 PM
CentOS Opening port for FTP Server Thin Linux - Distributions 3 11-16-2005 11:38 AM
cannot SFTP to SUSE 9.2 box, port 22 open, can putty in though using same port. jgrady Linux - Networking 6 03-29-2005 08:44 AM
How to open ports 25 and port 110 on proxy server SQUID? fdavid Linux - Newbie 1 03-16-2005 11:31 PM
CVS server open port question gstasica Linux - Networking 6 11-12-2004 07:48 AM


All times are GMT -5. The time now is 02:27 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration