LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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-10-2007, 10:06 AM   #1
steeles
LQ Newbie
 
Registered: Feb 2007
Posts: 15

Rep: Reputation: 0
problem: only one way (ssh/ftp) allow between two firewall server


machine A --> firewall1 (fw1, SuSE 10.2, upgrade from 9.1) --> fw2 --> machine B (SuSE 9.1)

problem 1.

problem is when I ftp from A to B, I can login fine, but no further action, when I do put, it will stuck. And it only create a file on machine B, and size is zero.

ftp> put zone.txt
500 Invalid PORT Command.
150 Opening BINARY mode data connection for zone.txt


problem 2.

I can ssh from A to B with no problem, but B can't ssh to A, it says

can't not connect to B port 22, no route to host.

what could be wrong. The only thing change is OS from 9.1 to 10.2, all configuration file is the same.


Please please advise.
 
Old 03-10-2007, 12:28 PM   #2
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Problem 1:

My guess is you are using active FTP, which generally poses a problem when the client machine has a firewall because of the way active FTP works. Unfortunately, I am not real knowledgable about FTP and you didn't tell me what you were using for a client. But you might see if you can run it in passive mode, which is more friendly for firewalls on the client side (but not for firewalls on the server side, IIRC). Since you apparently have ssh capability, you might also consider using the program sftp instead of trying to do FTP. sftp has FTP like capabilities and similar commands, but it puts the connection through an SSH tunnel, and it shouldn't have the firewall issues that FTP does. (You must still be able get a SSH connection through the firewall(s), but it sounds like you already have that taken care of.)

Problem 2:

Quote:
can't not connect to B port 22, no route to host.
My first reaction to this was you had a problem with your routing table. But if that were true I don't think you could have successfully ssh'd A -> B. You didn't tell me whether you were doing this with a host name or an IP address, but I am wondering if you really got the right IP address for A when you tried to ssh to A.
 
Old 03-10-2007, 04:31 PM   #3
steeles
LQ Newbie
 
Registered: Feb 2007
Posts: 15

Original Poster
Rep: Reputation: 0
I tried both IP and hostname, it is same thing. I ftp it from UNIX and windows, same thing. how to tell my ftp section is active or passive?

I noticed that if I ftp it from FW1 to B, I can successfully put/dir/get files, routing problem?


sorry, for problem 2, he situation is

A can ssh/ping to B, while B can't ssh/ping to A.
 
Old 03-10-2007, 07:08 PM   #4
steeles
LQ Newbie
 
Registered: Feb 2007
Posts: 15

Original Poster
Rep: Reputation: 0
someone suggested me to run

modprobe ip_conntrack_ftp and modeprobe ip_nat_ftp,

I tried first one, and it still didn't work. Then I tried ip_nat_ftp, and it works beautifully.

Is there any idea for my problem 2? I think it is a routing issue, but everything seems to be fine.

Help please.
 
Old 03-11-2007, 01:50 AM   #5
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by steeles
someone suggested me to run

modprobe ip_conntrack_ftp and modeprobe ip_nat_ftp,
Yeah, I forgot about those modules. FWIW, I checked the man page for ftp, and it says that passive mode is now its default. You used to select passive mode on it with -p. I don't know if that is the program you are using or not.

Quote:
Is there any idea for my problem 2? I think it is a routing issue, but everything seems to be fine.
My comment about hostname vs IP address was for problem 2. I also just looked at your diagram again. Is fw2 on machine B or is it another computer/device between A and B? If A and B are directly connected or connected via a simple hub/switch, and you are sure you are using the correct IP address for A, would you post what that address is and what the routing table on machine B is?

To list the routing table, type:

/sbin/route -n
 
Old 03-11-2007, 12:18 PM   #6
steeles
LQ Newbie
 
Registered: Feb 2007
Posts: 15

Original Poster
Rep: Reputation: 0
Hi,

For problem 2, ip and hostname made no difference.
They are all different physical machine.

A <-->FW1 <-->switch<--> FW2 <-->B

routing table for B.

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Iface
143.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 143.168.3.1 0.0.0.0 UG 0 0 0 eth0

143.168.3.1 is one of NIC in fw2.

143.168.3.11 is the ip for B.

The only change to this structure is I upgrade fw1 from SuSE linux 9.1 to SuSE 10.2, but using the same configuration file, unless there are some different firewall rule explaination in 10.2
 
Old 03-11-2007, 02:08 PM   #7
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Assuming 143.168.3.1 is the NIC in FW2 that is connected to B, it looks like B should route everything to FW2 OK. So I think the "unable to route" must be coming from something other than B. The only thing I can suggest is to use a packet sniffer such as tcpdump or wireshark on the various boxes to find out what is happening. I would start with B to see what is actually leaving and coming back into that box.
 
Old 03-15-2007, 01:25 PM   #8
steeles
LQ Newbie
 
Registered: Feb 2007
Posts: 15

Original Poster
Rep: Reputation: 0
I did some testings. And find something, hope you can give me some idea.

A (192.192.1.16 <-->FW1 (192.192.1.1) <-->switch<--> FW2 (143.168.3.1) <-->B (143.168.3.11)

routing table for B.

Kernel IP routing table

Destination Gateway Genmask Flags Metric Ref Iface
143.168.3.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 143.168.3.1 0.0.0.0 UG 0 0 0 eth0

143.168.3.1 is one of NIC in fw2.

143.168.3.11 is IP for B.


under /etc/sysconfig/SuSEfirewall2, the rule for FW_FORWARD_MAS is
0.0.0.0/0,192.192.1.168,tcp,22 means 0.0.0.0/0 --> tcp 22---> 192.192.1.168

so under FW1, I have following setup.

0.0.0.0/0,192.168.1.168,tcp,22
0.0.0.0/0,192.168.1.30,tcp,22
0.0.0.0/0,192.168.1.31,tcp,22

I find out that if I comment out the other two rules that also use port 22, then B can ssh to A!!!

0.0.0.0/0,192.168.1.168,tcp,22
#0.0.0.0/0,192.168.1.30,tcp,22
#0.0.0.0/0,192.168.1.31,tcp,22

Any advice for this?
 
Old 03-15-2007, 09:13 PM   #9
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
I am not familiar with SuSE, so I am not sure how the lines in that file actually translate to firewall rules. If there are not to many, perhaps you would like to post the actual firewall rules, i.e. post the output of the following two commands for FW1.

Code:
iptables -t nat -nvL
iptables -nvL
I am also wondering about the NICs on FW1 and FW2. Each box has two NICs? Are they on different subnets? I.e. what is each address and netmask?
 
Old 03-16-2007, 12:02 PM   #10
steeles
LQ Newbie
 
Registered: Feb 2007
Posts: 15

Original Poster
Rep: Reputation: 0
A (192.192.1.16 <-->FW1 (192.192.1.1) <-->switch<--> FW2 (143.168.3.1) <-->B (143.168.3.11)


fw1:/ # iptables -t nat -nvL
Chain PREROUTING (policy ACCEPT 17M packets, 1367M bytes)

pkts bytes target prot opt in out source destination

1 60 DNAT tcp -- eth1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 to:192.192.1.16:22

0 0 DNAT tcp -- eth1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 to:192.192.1.30:22

0 0 DNAT tcp -- eth1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 to:192.192.1.31:22

192.192.1.16 is machine A (sorry, I pasted wrong ip info before)


If I remove all above entries, I am okay!!!
If I only leave for port 22, if I ssh to different severs from machine B(143.168.3.11), it will go to 192.192.1.16

1 60 DNAT tcp -- eth1 * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 to:192.192.1.16:22


Please advise.

Last edited by steeles; 03-16-2007 at 12:13 PM.
 
Old 03-17-2007, 05:22 AM   #11
blackhole54
Senior Member
 
Registered: Mar 2006
Posts: 1,896

Rep: Reputation: 61
Quote:
Originally Posted by steeles
If I remove all above entries, I am okay!!!
I don't know why any of those rules should exist in the first place! (Do you have any idea how they got there?) But I also don't know how they would prevent B from sshing to A since the DNAT in the first rule sends all ssh packets to A anyway. And with the first rule in place, I don't see how the second and third rules can have any relevance (first match wins).

So it would seem that I am thoroughly confused ... Unless you have a good reason not to, and if it makes everything work, by all means, remove all 3 rules!
 
  


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
FTP and SSH through firewall hazmatt20 Linux - Networking 3 11-17-2008 11:17 PM
Suse 10.0 firewall and ftp server problem maximvs Linux - Networking 2 12-15-2005 02:11 AM
redhat as webserver, ftp server, Mail server, firewall ineth Linux - Newbie 1 09-10-2005 08:14 AM
Allowing ssh ftp through the firewall jmg1894 Linux - Newbie 5 07-08-2004 02:42 PM
Unable to access my ssh server and ftp server from the Internet, but smtp works foxone Linux - Networking 1 05-28-2004 05:17 PM

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

All times are GMT -5. The time now is 10:33 PM.

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