# Noob ssh question



## macdog303 (Mar 26, 2010)

Ok im just getting into bsd and i am loving it.  I have one problem though and i cannot get ssh to work when i get outside my network.  I have tried forwarding port 22 to the server but nothing works. i get a "ssh: connect to host ******.org port 22: Connection refused" error.  Thanks!


----------



## DutchDaemon (Mar 26, 2010)

Without an idea how your network and BSD box look (NAT? bridge? router? firewall? DSL/cable modem with port-forwarding? sshd running or not?) no meaningful answer can be expected...


----------



## macdog303 (Mar 26, 2010)

i just have a netgear router with nat disabled and port forwarding on port 22 to my machine.  Pretty sure i dont have a firewall.  sshd is running because i can ssh into the machine localy.


----------



## macdog303 (Mar 26, 2010)

O ya when i access the ip address through a brower it takes me to the router but i disabled remote router access.


----------



## jailed (Mar 27, 2010)

macdog303 said:
			
		

> i just have a netgear router with nat disabled and port forwarding on port 22 to my machine.


How did this router forwarding a port while nat disabled? Did you try to enable nat?



			
				macdog303 said:
			
		

> Pretty sure i dont have a firewall.


Unless you set a firewall, there's no default and active firewall on FreeBSD. So you're right, there's no firewall on your box.



			
				macdog303 said:
			
		

> sshd is running because i can ssh into the machine localy.


So it's not a freebsd or sshd problem. It's related with your router.


----------



## macdog303 (Mar 29, 2010)

There are only two option for my router for nat it is either open or sercure i have tried both and neither change anything. I have forwarded port 80 and 22 to my server but no luck and when i try to access the webserver in a broswer it just takes me to the router page.


----------



## SirDice (Mar 29, 2010)

If you turn of NAT what IP address does your machine get? Is it the Internet address or a private range address?

Try running tcpdump, something like `# tcpdump -Xni re0 port 22`. Or port 80 if you want to see HTTP.


----------



## macdog303 (Mar 29, 2010)

My router does not have an option to disable nat.


----------



## SirDice (Mar 29, 2010)

Ok, so you're getting a private address. Now use that tcpdump command to see if anything comes in on those ports. Also try to open other (higher numbered) ports, you can forward those to any port on your fbsd machine. Something like <external ip>, port 2222 to <fbsd>, port 22. Make use of tcpdump, learn how to use it. It's an invaluable tool to solve all sorts of network issues. 

If nothing comes in it's either the router or you have a very strict ISP. Netgear usually has all their manuals for download on their site, in case you can't find it. Perhaps a firmware upgrade is available that allows more features.


----------



## macdog303 (Mar 30, 2010)

Ok thanks sirdice.  I figured out my problem.  When i access the the server on my local network it takes me to the router.  When i am outside it works fine.  Darn netgear routers  THanks all.  For reference i have a wpn824v3 router.


----------

