LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-25-2005, 03:05 AM   #1
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Rep: Reputation: 59
linux router


about once every couple weeks (depends on how much downloading i do) my internet stops working so i have to reboot my router and it works again. afew hours ago i accidently stumbled upon using a linux pc as a router, which reminded me of how annoying that problem with my router is and has brought me to asking this question..

well, afew questions before i even look into it deeply:

1- somewhere it said that 'linux routers' are quite popular among the tech world. ok, sure.. but is it very usefull? i mean, my router works fine (other than the problem mentioned above) and it does everything i need it to do... will using a linux pc as a router make things faster at all?

2- iv skimmed over afew documents on how to set them up (including the tutorial here on LQ) and wonder how do the lan computers hook up to this 'router'? for the tutorial here @ LQ about this, it says one of the requirements are 2 NICs.. this mean 2 NICs just for the 'router'? or 1 NIC for the 'router', which supports/requires 1 more NIC [connection] for the lan computer?
if the 'router' requires 2 NICs ill end up trashing this whole idea cause i dont want to go out and buy another NIC. if only 1 is required for the router, how do you connect the lan PCs to it?
hmm.. i guess you probably would need a 2nd nic? even if so, what do you connect THAT to? i know one NIC would be required for the 'router' which connects to your modem/WAN connection, and the 2nd for.. a way of connection to the lan PCs it controls?

3- crap.. i actually had a 3rd one but forget, lol.

anyway, thanks for the input if possible.. and if things are looking good, ill be asking for more info if i decide to implement this

Thanks

Last edited by nadroj; 05-25-2005 at 03:07 AM.
 
Old 05-25-2005, 07:50 PM   #2
Moloko
Member
 
Registered: Mar 2004
Location: Netherlands
Distribution: Debian
Posts: 729

Rep: Reputation: 30
What kind of router do you have? Sounds like a fixable problem to me.

A linux pc as a router requires two network cards. Simple because one is used for the internet connection and the other to connect to the network. If you want to connect more pc's you'll also need a lan switch.

The router needs an iptables firewall to serve as a NAT router. Data traffic needs to be routed to the LAN. The networked pc's only need to know the local IP of the router which is the gateway.
 
Old 05-25-2005, 07:59 PM   #3
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Original Poster
Rep: Reputation: 59
so the only way i can use a linux pc to act as a router for my 2 PC lan is to buy a switch or hub? (point is: i have to buy SOMEthing)? if so, ill screw this idea

i have a DLink DI-704p router (here )
it seems to 'freeze' so i cant access the net and i have to shut it off and back on 10sec later. i think i emailed dlink about this like 2years ago and thats the solution they gave me, to reset it. but it shouldnt be necessary, but is probably what i will have to live with. i do have the latest firmware for it.
 
Old 05-25-2005, 08:17 PM   #4
Moloko
Member
 
Registered: Mar 2004
Location: Netherlands
Distribution: Debian
Posts: 729

Rep: Reputation: 30
The d-link might gives problems due to the MTU value of the NIC's. http://www.linuxquestions.org/questi...05/01/4/280271

As for the pc router, you'll need to buy something...Read some more on local networks:
http://www.hasenstein.com/linux-ip-n...lom/node4.html
http://yolinux.com/TUTORIALS/LinuxTu...rkGateway.html


You should get a clearer picture before starting this adventure. It seems to me you are not well enough informed yet. If you have 2 pc's one of them needs to be the router or get a third pc. The router obviously needs to on to have a connection to the internet from the other pc's.

About hubs: never! use hubs with Linux pc's. Always use switches.
 
Old 05-25-2005, 08:27 PM   #5
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Original Poster
Rep: Reputation: 59
as for the MTU, i have it set to what my ISP has specified. i always use the one they specified, and have, after experiencing this, changed the value to others and get same problem.

and for the linux router, i know i need a 3rd PC.. a linux computer that acts as a router.. i was saying besides the router, i have 2 PCs that it will control, which is my lan (that has 2 PCs..).

iv taken 2 networking courses and im in my 3rd yr for my computer programming diploma, so i am educated in it.

the purpose of my initial question is that i was just wondering how people usually did it, and if it was possible for me to do it without buying something (which is where i was puzzled at, because i knew i would have to buy something for this to possibly work). and also was wondering if it would be more efficient/faster.. since its a much faster device/cpu doing the forwarding, routing.
it seems pretty simple to setup and there seems to be afew good documentations describing it, so i could figure it out.. but, again, i was asking this with cost in mind. since i would have 2 buy a 2nd NIC for the linux router and a switch for the lan, i wont bother to.

Last edited by nadroj; 05-25-2005 at 08:29 PM.
 
Old 05-25-2005, 08:35 PM   #6
Moloko
Member
 
Registered: Mar 2004
Location: Netherlands
Distribution: Debian
Posts: 729

Rep: Reputation: 30
Did you change the mtu on all NIC's? Not just the router, but also the connected pc's?

p.s. Sorry if I misjudged you. It's hard to tell how much experience someone has from reading the posts.
 
Old 05-25-2005, 11:36 PM   #7
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
A linux router is a great thing, and forces you to do a good amount of configuration of things, which helps you to learn. You will notice no difference in speed or performance however. A router needs next to no processing or RAM. If you look at the technical specs for most desktop routers, you see something like 100 Mhz processors. The routing of packets is an extremely simple task. If you were to benchmark download speeds through your Dlink router and a linux box built to function as a router, you'd see a difference of only a few milliseconds if at all. To a real world application, you wouldn't be able to tell the difference.

I have run my box as a linux router/gateway for about 18 months. I got a 5 port hub for $5, and plugged the router and my other PCs in, and had DHCP running on the router to the rest of my network. I have received well more than $5 worth of service from that box.

Peace,
JimBass
 
Old 05-26-2005, 01:25 AM   #8
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Original Poster
Rep: Reputation: 59
moloko: no, i didnt change the mtu on all nics, never thought about it really. i did now that you mention it (well, did, afew hours ago, just finished watching SW3 ). the setting for it on my pc i found quite easily, on the other PC on the lan (sisters computer) i couldnt find the setting, oh well.
ill let you know if maybe me changing mine will effect anything, thanks.

jim: alright, thanks for the info, thast the rest of what i wanted to hear. ill probably just skip my experiment now, since iv already got this router (afew years ago, about 70$).. and since, which my main purpose for the question was, there wont be a noticeable/worthwhile increase in efficiency if its a highspeed CPU doing it or the router i have now.

edit: jim have you noticed any problems with using a HUB for the lan side of your network? as moloko stated earlier, he mentioned to never use hubs with linux lans, but switches rather.

Last edited by nadroj; 05-26-2005 at 01:27 AM.
 
Old 05-26-2005, 06:30 AM   #9
Moloko
Member
 
Registered: Mar 2004
Location: Netherlands
Distribution: Debian
Posts: 729

Rep: Reputation: 30
I didn't explain why I don't use hubs. They are incapable of simultaneous bidirectional data traffice and this will cause many data packets to get dropped. It works fine with http traffic (tcp), but it doesn't with for example NFS (udp). Data traffic slows down to a crawl. Switches don't have this handicap and offer full bidirectional capabalitites.

Pricetags have lowered for switches, so buying a hub is a waste of money
 
Old 05-26-2005, 08:24 AM   #10
JimBass
Senior Member
 
Registered: Oct 2003
Location: New York City
Distribution: Debian Sid 2.6.32
Posts: 2,100

Rep: Reputation: 49
The only time I have UDP packets moving across my hub is when my DNS box (behind my router/firewall) gets updates from the master on the public net. A zone file is maybe 200-400 characters of text, and I only have to transfer 1-5 of them at a time. I've never noticed a drop in speed while that happens. I don't use NFS, as I have a ftp service running on the router box on the inside addresses only. It is certainly possible that hubs do as Moloko suggests. Switches have become cheaper, but I haven't seen any as cheap as the $5-$20 range you can get hubs in. It would also make sense that there is a functional difference, which would help to justify the price difference.

Most likely, 99%+ of what you'll do with the connection makes a hub fine, but if you use NFS, you may well want to upgrade your connector from a hub to a switch.

Peace,
JimBass
 
Old 05-26-2005, 09:17 AM   #11
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
To reitterate things:

If you're not willing to buy anything, it's not going to work; unless you can pilfer the items from another source?

The requirements for a Linux(or BSD, which I prefer) router are very minimal and can do a lot of things more off-the-shelf SOHO routers can't. This includes advanced firewalling, VPN connections, and a host of other things.

There are several distributions that are made specifically to be routers-type installations, my favorite of these is SmoothWall. It is Linux based, but it's easy to setup and easy to manage. There is no X installation and all configuration is done via a web interface, like most hardware routers, with the option of using an SSL connection. The one I run serves about 16 users plus 3 servers, and it was an old IBM Aptiva(200MHz PentiumMMX, 32MB RAM, 3 GB HDD) but I recently upgraded it to a generic(home built) Pentium II 400MHz, 128 MB RAM, 10 GB HDD because I wantedto enable some extra functionality that required a little more power, such as Proxy server, Snort(intrusion detection), etc... This box does the following for my network:

-DHCP
-DNS/ NAT
-Firewalling
-Consistent 3-way VPN Connection between another office and the owner(my father-in-law)'s house
-Proxy server (soon with Dan's Guardian content filter)
-And more...
-And it keeps a TON of logs...

The new setup is probably a little overkill even for what I need, but it works nicely and the box is one I had laying around. The only things connected to it are the 2 Network cables and a power cable...

If your D-Link router does what you need it to other than the occasional freezing, you probably don't need to set up a full Linux box for a new router, because it's going to be overkill...

If you do want to look more into it, my recommendations to look into is:

SmoothWall (already linked)
m0n0wall - Similar to SmoothWall only based on FreeBSD, very nice!
Other than that, I would use OpenBD or NetBSD if you were going to use a true installation and configure it for the routing/firewalling services... If you wanted to do that, you then have the option of expanding the roles of your server when needing to things such as NFS/Samba server, Apache, FTP, etc...

I know this is long, but I hope it helped explain some things.
 
Old 05-26-2005, 01:33 PM   #12
nadroj
Senior Member
 
Registered: Jan 2005
Location: Canada
Distribution: ubuntu
Posts: 2,539

Original Poster
Rep: Reputation: 59
long, indeed, halo!

thanks alot for the info though, somewhat clears things up, yes.
i do have an old pc layin around downstairs, i dont even remember the speed, but >133 <400mhz, so i want to use it for SOMEthing, but since i would have to go out and purchase a switch (as stated earlier as the better choice) ill probably not bother with the experiment.
i think i ran into that smoothwall software you mentioned, when i was huntin around briefly for info/software for this.. also i remember running into FreeSCO (ciSCO, not SCO) which is a distro that is used as a firewall, and can even fit on a 3.5floppy! *BSD scares me lol
someday maybe ill give it an attempt, but i still need to understand linux first!

thanks guys for the help
 
Old 05-26-2005, 02:19 PM   #13
halo14
Senior Member
 
Registered: Apr 2004
Location: Surprise, AZ
Distribution: Debian | CentOS | Arch
Posts: 1,103

Rep: Reputation: 45
no problem..

good luck, and if you ever decide to take the plunge, we're always going to be here to help.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Small Linux Router/firewall behind D-Link Hardware router dleidlein Linux - Networking 6 04-30-2007 06:12 AM
linux router Doug Hammond Linux - Networking 2 02-05-2005 07:13 PM
Linux Router & Netgear Wireless Router DMaCATO Linux - Wireless Networking 1 04-30-2004 10:16 AM
/etc/resolv.conf configuration when behind a router(not a linux router) rmanocha Linux - Networking 2 04-28-2004 02:52 AM
ADSL Router + Linux Router + LAN = HELP!!! linuxlois Linux - General 2 09-16-2003 09:24 AM


All times are GMT -5. The time now is 02:36 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration