building a linux router

Posted on 2003-03-15
Medium Priority
Last Modified: 2010-03-18
I've got a 350mhz pentium with 64mb memory and 6gb hard drive that I'd love to make into a router for a private LAN with internet access. The proposed linux router has 4 network cards and is running Debian 2.2.22 kernel. I'd like to know how to configure the network with one card for pppoe with a dsl modem, and the other 3 cards to connect to 3 local computers running linux and winxp. I need all the config files and other settings for the linux router and the other linux machines. My idea is to enable internet access and file sharing for each of the 3 client machines. I know how to configure Samba; I don't know the network configuration commands and config files needed to make build the network.  Thanks.  Vince
Question by:vlt123
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +4
LVL 10

Expert Comment

ID: 8145540
there is a project just made for this
its named as linux router project
LVL 10

Accepted Solution

kiranghag earned 176 total points
ID: 8145545
LVL 10

Expert Comment

ID: 8145571
this is meant for a dedicated machine though...
you need to look in help for NAT/routing on linux for getting ut work done..
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Assisted Solution

Ustas earned 168 total points
ID: 8147926
Although not recommended, you can use a ready-made firewall script that will cater for NAT and general security of the router. Alternative is to write a custom script manually.

Here is the script:

contains network interface settings for their appropriate names : eth0 through to eth4 in your case.

command used to alter these setting in the run time is either /sbin/ifconfig
or /sbin/ip
(use "ip link" and "ip addr" for interface setup)

directory contains the config files for PPP links

pppoe command is what you need I guess for pppoe connection.
LVL 10

Expert Comment

ID: 8148737
if net sharing is your prime requirement...hen also setup squid as caching proxy for the internet...its would improve your performance if u access same sites frequently...

Expert Comment

ID: 8149822
Also ...Try e-smith...i love this thing ....www.e-smith.org
It has a build in router-nat-dialup/xdsl/cable ipmasquerade....webserver...mailserver..ftp...samba server..all in one...simply GREAT
LVL 19

Assisted Solution

by:Gabriel Orozco
Gabriel Orozco earned 168 total points
ID: 8151856
just setup this firewall/internet sharing script in a file called /etc/rc.d/rc.firewall

and call it from your /etc/rc.d/rc.local
(just add a line like this: /etc/rc.d/rc.firewall)

Per your configuration, this could help:

# I think you have DSL. if it's already starting, then
# delete the "adsl-start" line:

#Activate IP Forwarding
echo 1 > /proc/sys/net/ipv4/ip_forward


$ipt -F
$ipt -t nat -F
$ipt -t mangle -F

$ipt -A INPUT -i lo -j ACCEPT
$ipt -A INPUT -i $inside -j ACCEPT
$ipt -A OUTPUT -i $inside -j ACCEPT
$ipt -A FORWARD -i $inside -j ACCEPT

$ipt -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
#Accept at least traffic to ssh into this host.
$ipt -A INPUT -p tcp --dport 22 -j ACCEPT
#now the nat thing.
$ipt -t nat -A POSTROUTING -o $outside -j MASQUERADE

This script will not forward anything from eth0 to eth1.
as you asked to be, but forwards (it does not nat) from eth1 to eth0, and NAT from eth1 to ppp0, any ip they could have.

you do not need a network card for each other computer you have. it's way simpler to have a HUB/SWITCH and connect your eth0 network card to it, and all other computers to the same HUB/SWITCH.

now, just setup the ip address of your eth0, and in all other computers setup that IP as the gateway to the internet.

it's that simple.

check this diagram:


you can see your linuxbox has two ends. one is the network card connected to the dsl modem, and the other is the card connected to the hub, which in turn connect all the computers.

a good network subnet if you do not know how to begin is, which means your linux box will be, and all other computers will follow with, .3, .4 etc. and same netmask.
all the other computers should have as the default gateway, and your linux box should not have a gateway setup, as the dsl utility need to setup the default gateway dinamically.

Hope this helps

Assisted Solution

sumsam earned 168 total points
ID: 8160164
look to make my linux machine a router what i did, i first made all my lan cards up, obviously with an ip address each. this u can do with the help of running "#setup" command. or use the "#ifconfig" comman.
next u have to see the routing table of ur machine, with the help of "#route" command. set teh routing table according to ur needs.
see the man pages of "ifconfig" and "route". its easy, u can do it.
good luck.

Expert Comment

ID: 8160180
one more thing is that u can make static routes more easily.
LVL 19

Expert Comment

by:Gabriel Orozco
ID: 8169745
any news?

Author Comment

ID: 8170400
I'm going to try to see if sumsam's suggestions will work for me. Redimido's solution requires using a hub which I would rather not do.  Thanks.

Expert Comment

ID: 9077656
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Post your closing recommendations!  No comment means you don't care.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question