LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 03-06-2009, 03:43 AM   #1
zodehala
Member
 
Registered: Nov 2008
Posts: 53

Rep: Reputation: 15
remote ssh access from port 2222


i can not access centos from remote

our network is following
http://img24.imageshack.us/img24/2954/gif1u.gif


i forward 2222 to centos IP (192.168.1.250)from modem

and

i accept all tcp request from port 2222
Code:
iptables -A INPUT -p tcp --dport 2222 -j ACCEPT
what will i do for firewall or other ?

Last edited by zodehala; 03-09-2009 at 09:06 AM.
 
Old 03-06-2009, 04:32 PM   #2
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Rep: Reputation: 32
More Info

Unfortunately I can not access you network picture.

But...I give it a shot.

I think your server is behind an access-point and you access the port 2222 at the accesspoint which is forwarded to the other machine.

As you use iptables you have a stateful-inspection-firewall which will be able to notice what connection are already running and if an ip packet that leaves the pc trough the output chain belong to a allowed connection.

If you are sure that the packet reaches the second machine you maybe did not allow the second machine to answer.

To prove this we will need the
a) iptables -nvL FORWARD of the first
b) iptables -nvL OUTPUT of the second machine

If you would not like to post those thing here, maybe you just try the following

On the second machine add the following rule:
Quote:
iptables -I OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
This will allow all packages related to a granted connection to be able to leave the second pc.

If this does not help, we will need more info. Maybe the first pc does not let some packages trough.
 
Old 03-09-2009, 09:13 AM   #3
zodehala
Member
 
Registered: Nov 2008
Posts: 53

Original Poster
Rep: Reputation: 15
for centos 5.2 (first machine namely machine which i want to connect from remote)
Code:
[root@localhost ~]# iptables -nvL FORWARD
Chain FORWARD (policy ACCEPT 0 packets, 0 bytes)
 pkts bytes target     prot opt in     out     source               destination
    0     0 ACCEPT     all  --  *      virbr0  0.0.0.0/0            192.168.122.0/24    state RELATED,ESTABLISHED
    0     0 ACCEPT     all  --  virbr0 *       192.168.122.0/24     0.0.0.0/0
    0     0 ACCEPT     all  --  virbr0 virbr0  0.0.0.0/0            0.0.0.0/0
    0     0 REJECT     all  --  *      virbr0  0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable
    0     0 REJECT     all  --  virbr0 *       0.0.0.0/0            0.0.0.0/0           reject-with icmp-port-unreachable
    0     0 RH-Firewall-1-INPUT  all  --  *      *       0.0.0.0/0            0.0.0.0/0
[root@localhost ~]#
i am tyring to connect through a ssh cliend in windows XP (Second machine)
 
Old 05-26-2009, 03:46 PM   #4
saavik
Member
 
Registered: Nov 2001
Location: NRW, Germany
Distribution: SLES / FC/ OES / CentOS
Posts: 614

Rep: Reputation: 32
i am pretty sure that this can`t work as you did just append ( -A ) a rule to the iptables.

If this is still an actual problem, I am sure we can solve it by two rules.

a) iptables -I INPUT -p tcp --dport 2222 -j ACCEPT
b) iptables -I OUTPUT -m state --state RELATED,ESTABLISHED -j ACCEPT

just give us the

iptables -nvL

output and we get it working.
 
  


Reply



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
how to open a port for remote access as root craftereric Linux - Newbie 2 08-11-2008 11:38 AM
How do I open a port for Oracle for remote access? koobi Linux - General 0 09-21-2007 04:06 AM
iptables help! DROP ssh port, but allow to connect to ssh if from 2222 port kandzha Linux - Networking 4 09-13-2006 09:10 AM
Remote Access, reverse ssh haxcess Linux - Networking 1 12-09-2005 11:47 AM
Remote access question. (ssh) JohnStormrider Linux - Networking 8 09-20-2005 04:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration