Linux - NewbieThis 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!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
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
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.
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.
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.
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.
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.
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.
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
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.
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:
-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 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.
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!