# noob question about setting up a server that routs

## carbon

hi,

i am wanting to setup a server which i can login remotely and do stuff like i am in front of it anywhere. i am using DSL btw.

i have a router and direct connection is always refused coz it is behind router, some of my rfriend told me you can get around it by setting up a server which i have no idea what is it all about.

i heard apache, ssh, blah blah blah. confuses me alot.

any place that explaint the basic of server or you can just go ahead and tell me what to do. any advice is welcomed.

thanks for reading.

----------

## NeddySeagoon

carbon,

You need to run sshd on the remote machine so that it will accept incoming  ssh requests.

Your 'router' may do a lot more than just route. Network Address Translation (NAT) and firewalling perhaps?

You need to configure the router to forward port 22 to the remote machine or ssh packets will never reach it. (Your router/firewall will drop them)

Now you can log into it with the ssh command, as in

ssh -X <ipaddress>

or if you need to be a different user on the remote box

ssh -X -l <user> <ipaddress>

-X forwrds X protocol

-l is login

<user> is your user name on the remote box

<ipaddress> is the ip address of the remote machine, or the router, if the router does NAT.

See man ssh too.

By way of testing, you can run the server and client on the same pc then ssh 127.0.0.1 should open a secure connection to allow your pc to talk to itself on the network. It shows that ssh is set up OK

Regards,

Neddyseagoon

----------

## carbon

how do you configure the router, mine is a netgear whatever, it has 4 ports

and i have hub too , just so i only need to get 1 line from downstairs to upstairs and computer upstairs can share the connection.

my future will place on downstairs tho.

haha sorry to make you read my decoration.

----------

## devon

 *carbon wrote:*   

> how do you configure the router, mine is a netgear whatever, it has 4 ports

 

Look in your Netgear install manual/CD for "forwarding", "port forwarding", "running services", etc.

----------

## NeddySeagoon

carbon,

With a bit of. luck, your router may already be managing your network.

Look in /etc/conf.d/net for a line that starts

#iface_eth0="dhcp"

If the '#' is missing your luck is in.

Set up the second PC the same way and plug it in. It should 'just work'.

Regards,

NeddySeagoon

----------

## carbon

what about windows box?

i have a winxp machine that connect to the router thru a hub

----------

## carbon

what is a must in make menuconfig if it needs to work as a server?

ftp server for instance.

----------

## devon

 *carbon wrote:*   

> what about windows box?
> 
> i have a winxp machine that connect to the router thru a hub

 

What about your Windows box?

 *carbon wrote:*   

> what is a must in make menuconfig if it needs to work as a server?
> 
> ftp server for instance.

 

The kernel has to have basic TCP/IP support.  :Smile:  From there, install a ftpd program like net-ftp/vsftpd.

----------

## carbon

i mean how does the windows box get around the router to have direct peer to peer connection available.

----------

## devon

 *carbon wrote:*   

> i mean how does the windows box get around the router to have direct peer to peer connection available.

 

You want the Windows box to talk to the Gentoo box and vice-versa? The Netgear has four ports, which is switched internally. So the Windows box and Gentoo box will communicate with one another without using the router. Can you not ping from the Gentoo <-> Windows?

----------

## carbon

arrrr, ok the situation is this.

if my windows box is behind the router, people cannot send me file with ICQ.

but people that i know tells me that if i setup a server , then there will be way to get around this.

not sure if thats true.  :Embarassed: 

----------

## devon

 *carbon wrote:*   

> but people that i know tells me that if i setup a server , then there will be way to get around this. 
> 
> not sure if thats true.

 

Sure... They can upload the file to your server and then you can download it.  :Wink: 

I would check out the manual for your Netgear about port forwarding. It would be prudent to make sure it is possible before diving into setting your own server. You may have to visit their website for more detail since the days of actually getting a manual rather than a piece of paper titled "Install Guide" are gone.  :Sad: 

----------

## carbon

i looked at the netgear http interface, it has a place where you configure port forwarding

if i want ftp and ssh to work, which port shall forward to which ip?

----------

## devon

ssh is tcp/22

ftp is tcp/21, tcp/20

Does the Netgear have a pre-defined FTP service option? I would use that. I am concerned that passive/active transfers between two firewalls (one at the end user and one at the server) may cause problems unless the firewalls are statefull. 

You forward them to whatever IP has those services running.  :Smile: 

----------

## carbon

thanks!!

plus, i am running a text base ICQ on the gentoo machine.

what i want to do is, i can ssh to the machine and be able to continue to use my running text base icq. how to do that?

----------

## carbon

say my gentoo machine has ftp server and ssh server running

and the gentoo machine has an ip IP1

and my windows box has an ip IP2

so at the router port forwarding service, i make it forward port 22(ssh) to ip1 and port 21(ftp) to ip1?

what if i want port22 to be forwarded to my windows box too?

i guess this comes down to if ports arent explicitly forwarded, they will get dropped. is that right?

----------

## devon

 *Quote:*   

> what i want to do is, i can ssh to the machine and be able to continue to use my running text base icq. how to do that?

 

I used to do that with IRC and I still do when I connect to my Gentoo box from work to do some maintenance. I just ssh into it and then run any commands I want like I was at the console.

 *Quote:*   

> what if i want port22 to be forwarded to my windows box too

 

For ssh to the Windows box? Unless you get multiple IPs from your ISP, you can't. You have to have sshd on your Windows box listen on a different port than 22 (e.g. 2200) and then forward that port to your Windows box.

 *Quote:*   

> i guess this comes down to if ports arent explicitly forwarded, they will get dropped. is that right?

 

They should if your firewall is worth anything.  :Smile: 

----------

## carbon

regarding the ICQ thing, what i am trying to do is have icq running 24/7, and i can log into my gentoo box to "continue" to operate the running icq.

if i log on with ssh and open ICQ again, it wont do what i am trying to do.

any clue?

another question, if say my windows box also have a ssh server running, and i make it listen on port 9999, then i will have to forward port 9999 to my windows's ip right?

i understand why i only have 1 ip now, coz there is only 1 DSL modem. how to find out what is the ip that my ISP assigned me? plus if it was dynamic, how do i know what is my IP when i am not home?

----------

## devon

 *Quote:*   

> regarding the ICQ thing, what i am trying to do is have icq running 24/7, and i can log into my gentoo box to "continue" to operate the running icq. if i log on with ssh and open ICQ again, it wont do what i am trying to do.
> 
> any clue?

 

Use screen.  :Smile:  Screen allows to manage terminal screens (e.g. attach/detach from programs when moving). Startup the ICQ program with "screen -A -m -d -S icq /some/location/icq" and then do a "screen -r icq" to connect to that screen. Then do CTRL+A+D to disconnect when you leave for work/school and then do "screen -r icq" again to re-connect. "man screen" for more information.

 *Quote:*   

> another question, if say my windows box also have a ssh server running, and i make it listen on port 9999, then i will have to forward port 9999 to my windows's ip right? 

 

Yes. You also have to tell ssh what port to use when connecting to the foreign host. ssh versus ssh -p <port>.

 *Quote:*   

> i understand why i only have 1 ip now, coz there is only 1 DSL modem. how to find out what is the ip that my ISP assigned me? plus if it was dynamic, how do i know what is my IP when i am not home?

 

To find out your current IP, you can go to www.whatismyip.com and see it there. If it changes a lot, you either need to write a script that notifies you of the new IP or use a dynamic DNS service.

----------

## carbon

dynamic DNS service?

who provides that? does it cost money??

----------

## devon

 *carbon wrote:*   

> dynamic DNS service?
> 
> who provides that? does it cost money??

 

I believe there are several companies, but I only know of one, DynDNS. And according to http://www.dyndns.org/services/pricing.html, it is free.

You may want to do a forum search looking for suggestions and/or post a message asking for some. I don't use a dynamic DNS service since my IP doesn't change that much and I run my own DNS.  :Smile: 

----------

## carbon

my netgear router http interface has a DNS service, is it possible that a dynamic DNS service is already built into the router?

plus, can i reach the http interface of the router or is it just seeable from within the LAN?

----------

## devon

 *Quote:*   

> my netgear router http interface has a DNS service, is it possible that a dynamic DNS service is already built into the router?

 

That allows your Netgear to notify your dynamic DNS service when your IP changes. I would consult your user's manual.  :Smile: 

 *Quote:*   

> plus, can i reach the http interface of the router or is it just seeable from within the LAN?

 

It should be only accessible from the LAN side. You may be able to change that, but I would do so with extreme caution as it will allow others access to your configuration (assuming they get the password).

----------

## carbon

i emerged proftpd and when i try to ftp it with a ftp program, it starts at the home directory

/home/blah

and i can netvigate anywhere on the hard drive, and i wanna find out how to prevent that

can i setup a "root" folder which people connects thru the ftp port goes there and cannot go up a level?

----------

## carbon

one more question   :Embarassed: 

does ping go thru a specific port as well? coz i cant ping my gentoo machine at home from work

----------

## devon

 *carbon wrote:*   

> i emerged proftpd and when i try to ftp it with a ftp program, it starts at the home directory /home/blah and i can netvigate anywhere on the hard drive, and i wanna find out how to prevent that can i setup a "root" folder which people connects thru the ftp port goes there and cannot go up a level?

 

I don't use proftpd; I use vsftpd. I would start a new thread asking that.

 *carbon wrote:*   

> does ping go thru a specific port as well? coz i cant ping my gentoo machine at home from work

 

Ping uses ICMP, so you will need to forward ICMP through your firewall to your Gentoo box.

----------

