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 06-01-2004, 05:35 PM   #1
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Rep: Reputation: 30
Accessing server behind router :: setting up network


I think this is a somewhat stupid question, but I've searched for it, and couldn't find anything. I want to set up a home network with an apache and proftpd server that I can access from outside my house. So basiclly what I want to do is have the apache server on one computer and the proftpd on another. I want to have a third act as a router.
My question is how do I actually do this. I assumed I would use a DHCP dameon to assign IP's to the computers, but then how would they be accessable to people outside the network? What address would they use? Basiclly I'm looking for a How To, I've searched google, those how tos don't tell how to access computers from outside the network.

-Thanks in advance
 
Old 06-02-2004, 02:27 AM   #2
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
first, if I have understood you:

/ PC2 (with Apache)
|
[switch/hub]---------- PC1 (router) ------ internet
|
\ PC3 (with ftp server)

that is to say PC1 is the only one connected directly with interet whether connected via dsl, cable or ppp modem. So I assume that you don't have a router device because if you had a router device (not pc) the situation would be totally different.

Well I would assign statics IP to PC1, PC2 and PC3. PC1 should have (at least) two network interfaces (with 2 ip's). One visible from internet and one visible from local network, so I would do:

PC1 : 192.168.0.1 ( & X.X.X.X assigned to you by your internet provider)
PC2 : 192.168.0.2
PC3 : 192.168.0.3

In all of them the local network mask is 255.255.255.0.
In PC2 and PC3 you must set the default gateway to 192.168.0.1 (PC1 internal IP).

In PC1 I would create rules (with iptables) to route all the traffic incoming (from internet) to the 80 port to 192.168.0.2:80 and the traffic incoming (from internet) to the 21 port to 192.168.0.3:21. Of course you can have the apache server and the ftp server running in the same pc. You don't need 2 pc's.

People who wants to access the servers from the outside only has to know the IP that your internet provider has assigned to yo.

I hope it may help you.
Bye.


Last edited by Goala; 06-02-2004 at 04:38 AM.
 
Old 06-02-2004, 01:26 PM   #3
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Original Poster
Rep: Reputation: 30
So if the hostname of the computer with apache is www and the hostname of the computer with proftpd is ftp, then would I telnet to the one with apache by doing

# telnet apache.mycomputer.com

assuming mycoputer.com was the domain?

and how would the situation be different if I had a real router?
 
Old 06-02-2004, 02:14 PM   #4
crazyeddie740
Member
 
Registered: May 2004
Location: Sedalia, MO
Distribution: Debian, Mandrake
Posts: 71

Rep: Reputation: 15
First of, what Goala is describing is a NAT router. You can forward any port from the NAT router outside address to one ip address on your lan (you would have to set up static ips on the lan, generally with a 192.0.0.x address) You can't forward the same port to two different addresses, so your best bet would be to telnet (or better yet SSH) to the computer you're using as the router and telnet to the lan computers from there.

So it would be more like this:

random_outside computer# telnet mycomputer.com
mycomputer.com# telnet apache
apache#


Secondly, a real router wouldn't be worth it for your situation. if you use a real router, as opposed to a NAT router, you would have to get a seperate "real world" static ip address for each computer on your lan, including a second one for the router. Could be with a seperate network address from your isp, but all the ips on your lan would have to have the same network address.

Hope that cleared things up instead of just confusing more.
 
Old 06-02-2004, 02:22 PM   #5
LuggerHouse
Member
 
Registered: May 2004
Location: Montreal,QC,Canada
Distribution: Fedora Core 7
Posts: 210

Rep: Reputation: 30
Gee...
I was just writing this answer myself !! Thing are moving fast here!!

I was just worry, are'nt those static private adresses should be masqueraded ??
 
Old 06-02-2004, 10:38 PM   #6
slackwarefan
Member
 
Registered: Oct 2003
Location: Florida
Distribution: Slackware
Posts: 273

Original Poster
Rep: Reputation: 30
so what you're saying is that I could forward 21 to the proftpd computer and 80 ( or in my case 1025) to the apache computer, but I would not be able to telnet them both without special measures?

Last edited by slackwarefan; 06-03-2004 at 02:37 AM.
 
Old 06-03-2004, 04:42 AM   #7
Goala
Member
 
Registered: May 2004
Location: Merida (Spain)
Distribution: Debian
Posts: 89

Rep: Reputation: 15
slackwarefan:
you can't do this (from a external machine) without take special measures:

(first, I would forget telnet. Use ssh instead !! ).

$ telnet www.mycomputer.com
$ telnet ftp.mycomputer.com

(look for virtual domains in google, perhaps you can find anything that may help you. I know (almost) nothing about it).

instead you could do:
$ telnet mycomputer.com 8855
$ telnet mycomputer.com 8844

to do that you must do the telnetd service in www to listen to 8855 and in the ftp machine to listen 8844 (use the ports you like). And make rules in the router to route the traffic according to that.

Bye.
 
Old 06-03-2004, 04:14 PM   #8
crazyeddie740
Member
 
Registered: May 2004
Location: Sedalia, MO
Distribution: Debian, Mandrake
Posts: 71

Rep: Reputation: 15
Actually, it might not be such a good idea to doing any remote administration of the firewall. Maybe a better idea to forward the ssh port to the ftp box (assuming it has less of a load than the apache box) and ssh from there to the apache box? Depends on how paranoid you are about somebody getting on the firewall.
 
  


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
Problem with accessing other network server when connected from a dial-in server radatan71 Linux - Networking 0 11-22-2005 02:20 AM
Setting up a linux router for network ThePlague Linux - Networking 5 02-24-2005 03:45 PM
setting up a network through a router (mandrake 10.1) ben_build#2.1.0 Linux - Networking 1 01-02-2005 07:14 PM
problems setting up apache and vsftp server behind a router that serves as a server xone Linux - Security 1 04-08-2004 10:46 AM
Accessing a network behind a router esteeven Linux - Networking 5 12-04-2002 01:27 PM

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

All times are GMT -5. The time now is 05:11 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