# How open FTP connection PF?



## cracker1985 (Feb 21, 2014)

Hello everyone,

I have freebsd+pf machine. Already configured NAT. I am installed new FTP server in our LAN. From local network i can log in to this server and everythink is fine. But from outside my gateway server redirects connection to FTP server. Login screen appears, but after login with credentials nothing happened. Cannot see any data, only blank page. How can i fix this? Thank you 
This is my pf.conf:


```
#normalization
scrub in all
##NAT and RDR start
nat-anchor "ftp-proxy/*"
rdr-anchor "ftp-proxy/*"
###Redirect ftp traffic
rdr on $ext_if proto tcp from any to any port 21 -> 12.0.1.217

nat on $ext_if from 192.168.99.128/25 to any port $safe_nat_ports -> $ext_if
nat on $ext_if from 12.0.0.0/21 to any port $safe_nat_ports -> $ext_if
nat on $ext_if from <clients> to any -> $ext_ip

pass in all
block out quick on ext_if proto tcp to port 445
block out quick on ext_if proto udp to port 445
pass out all
antispoof quick for { lo $int_if }

# allow pfsync over the internal nics connected by a cross cable
pass quick on $sync_if proto pfsync
pass quick on $int_if proto carp
pass quick on $ext_if proto carp
pass quick on $vlan1000_if proto carp
#pass in quick on $ext_if proto tcp to ($ext_if) port 5631
pass in quick on $int_if proto tcp to 12.0.0.1 port 53
pass in quick on $int_if proto udp to 12.0.0.1 port 53
pass in quick on $int_if proto tcp to 12.0.0.1 port 8080
pass in quick on $int_if inet proto icmp all
pass in quick on $ext_if inet proto icmp all
pass in quick on $vlan1000_if inet proto icmp all
```


----------



## SirDice (Feb 21, 2014)

Does your gateway server use any kind of NAT? @lamany1977 has a similar problem here: viewtopic.php?f=43&t=45047 Definitely have a read through the link I posted, it explains how FTP works and it'll give you some insight _why_ it doesn't work.

If want to use FTP to share some files it'll be easier to use a simple web server for it. Then you'll only have a single port to deal with and not some dynamically chosen data channel.


----------



## cracker1985 (Feb 21, 2014)

SirDice said:
			
		

> Does your gateway server use any kind of NAT? @lamany1977 has a similar problem here: viewtopic.php?f=43&t=45047 Definitely have a read through the link I posted, it explains how FTP works and it'll give you some insight _why_ it doesn't work.
> 
> If want to use FTP to share some files it'll be easier to use a simple web server for it. Then you'll only have a single port to deal with and not some dynamically chosen data channel.



Thank you for answer. I am really appreciate your work in this forum. But as you know i am newbie in Freebsd. I have  already read this link. But i don't understand.... Can you explain in my pf.conf file?


----------



## SirDice (Feb 21, 2014)

Your pf.conf probably isn't the reason why it's not working because it does work from the LAN. Most likely is your gateway that prevents it from working. Especially if that gateway uses NAT.


----------

