LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   NAT- ssh Firewall Issue (https://www.linuxquestions.org/questions/linux-security-4/nat-ssh-firewall-issue-347382/)

moejab 07-27-2005 02:44 PM

NAT- ssh Firewall Issue
 
First of all, I am a newbie to Linux. I am using a Linux box as a firewall. I have the following set up:

Linux box 2 nic's: NIC #1 has 2 Public addresses (Used for NAT), NIC #2 Private going into a fastHub.

Windows box behind firewal with only a public address.

Linux is providing NAT on NIC#1.1 for the private address on Win box

Problem: Based on my firewall configurations I am allowing ssh to NIC# 1 from a specific LAN PC, but it will not allow me to ssh through Linux firewall to Window PC.

NATing is working.

My forward config is as follows:

IPTABLES -A FORWARD -p tcp -s public/32 -d private/32 --dport 22 -j ACCEPT

Please advice.

Thx
Moe

Matir 07-27-2005 02:47 PM

You would need to portforward to ssh in to boxes behind the firewall (I assume this is what you want).

lynrees 07-27-2005 04:20 PM

Have you really got an ssh server running on your windows box?

I've had them running but found them flaky!

Anyway, you need port forwarding aka inbound NAT.

You need to specify that inbound traffic to say port 222 at the firewall is forwarded to port 22 of your internal computer's IP address.

Not sure what the iptables voodoo looks like off the top of my head, however you know what to google for now.

Matir 07-27-2005 04:25 PM

Port forwarding with iptables is more or less just:
Code:

EXT_IF=eth1 #external interface
INTERNAL_BOX=192.168.0.5 #box running sshd
/sbin/iptables -A FORWARD -i $EXT_IF -p tcp --dport 22 -j ACCEPT
/sbin/iptables -t nat -A PREROUTING -p tcp --dport 222 -j DNAT --to $INTERNAL_BOX:22



All times are GMT -5. The time now is 09:52 AM.