Building a Router from Scratch: A Beginner's Guide

In summary: I've also been working as a router testing engineer... so I have a basic understanding of their architecture.So, in summary,- You should study DD-WRT to get started- You should understand the low level functions of routers- You should do this in order to better understand router networks.
  • #1
sergeyrar
10
0
Hi,

I want to build a router from scratch

Does anyone have a good guide to help me get started ?

Thanks,
 
Engineering news on Phys.org
  • #2
Yes. Go to school for electrical engineering and computer science. I know this sounds like a cocky answer but anyone who would ask that question does not understand the complexities of this endeavor.
 
  • Like
Likes Jeff Rosenbury, davenn and Greg Bernhardt
  • #3
I understand the complexities... I have studied in this specific field , but a long time ago. - finished practical engineering and computer science.
But, for the past 5 years my main focus was on networking, on a high level... more of how packets are routed through the internet.
And I work as a router testing engineer.. so I have a basic understanding of their architecture.
Just need a guide, or a book ... something to start with.
 
  • #4
I would assume you need to learn how to program up microprocessors in assembly language. That would be the first step. You should probably dissect routers and similar equipment to learn how they work.
 
  • #5
sergeyrar said:
And I work as a router testing engineer.. so I have a basic understanding of their architecture.
Then I guess you will have seen the level of complexity of the PCBs that are used in commercial routers. Do you have access to suitable equipment to manufacture a circuit yourself?
 
  • #6
Give me a break. What a bunch of terrible negative advice.

Why do you all have to be that way. I see it here a lot, and some of the people in this thread are MASTERS at pointing out how something is "too complex" and then provide no help. Acting like Smarty pants know it alls
If you can't say anything USEFUL or supportive, then don't post. Your advice is useless.

If you want to point out something is complex, at least link to some information that will support or illustrate your argument. Not one answer showed or shared any understanding of routers or router complexity. It's like I said I wanted to make cookies from scratch and you all start telling me how hard it is to manage a wheat farm.

So, in response to the original question.

A great place to start is dd-wrt, ( http://www.dd-wrt.com/wiki/index.php/What_is_DD-WRT? )an open source router that runs on a variety of different hardware. The source code is available.
By studying that firmware you can also begin to learn what is required from a system hardware standpoint.

1. Do you really understand router top level functions. Could you make a list of top level features a typical router might support
2. DO you have a reason for doing this? Are there router features that you think are needed in the marketplace, but are not provided.
3. Do you really want to build router hardware (that is, design and implement your own fully integrated microprocessor and communications peripherals system)
4. "Designing from scratch" can mean many things. Why would you design your own ethernet stack when there are stacks available? Or your own TCP stack?
Do you know what an ethernet stack or TCP stack are?
5. Since you work at testing routers, do you understand all of the low level functional blocks and interfaces incorporated within the hardware and firmware?

Hopefully that will give you some idea of the complexity of the task you have chosen for yourself.

What does a "router testing ENGINEER" do, anyway? WHat, exactly, do you ENGINEER. It seem strange that you can design tests for a router, but would ask that very general, almost bottomless question on a forum.
 
  • Like
Likes velvet thunder, puf_the_majic_dragon and Jeff Rosenbury
  • #7
Hi, thanks for the informative reply!
I once made a project of controlling a robot from PC via a transmitter connected to the RS-232 exit, was real fun and interesting to get this thing going just by hitting keys on my keyboard.
I remember programming it with assembly, and used visual basic to draw its movement on a map - but it was quite long ago.. so I need to refresh my memory on that.

1. I know router top level functions - this is actually my main focus today.
2. I want to do this in order to help myself better understand routers, and maybe develop something new.. it just sounds existing to build it form scratch!
3. Yes.
4. I suppose I can use some existing libraries, and not do everything from scratch ... so goes for hardware.. I'm not interested in building my chips by myself (using transistors, and logical gates) , I can buy dedicated chips and program them (as long as I remind myself how).
5. I have the big picture.. and this is one of the things that drives me to build a router.. I want to better understand it on the low level.

For the past 5 years or so I've been working with router networks, and I learned a lot about all their features and functions - on a high level , main focus was the interaction between routers and switches in the network.

On my job today , I do high level testing and I design tests for routers... I test high level router functions - such as routing protocols using sniffers and traffic generators.
I've been exposed to the main building blocks of a generic router, and I want to dive in and get to know how it works on the lowest level - I believe I can do this since I had some experience in programming hardware and have some knowledge in electronics and programming.
 
  • #8
I have found this guide - which I think fits my porpuse -
http://www.learn-c.com/alltoget.htm

Is it still relevant? :D (its from y2k)
Is there anything similar more up to date?
 
  • #9
I don't know what the best online resource is to learn C (if that is what you were thinking you would get from that link). I would look for an online lecture series, like college courses. You should search this forum's programming section, or possibly post there. For example https://www.physicsforums.com/threads/programming-resources.15689/

The link you posted is somewhat "relevant", but there is not much content there.

learning C is one thing
learning operating system functions is another
learning driver structures is another
and it goes on and on

I'm a hardware designer, so I could go on and on about what you need to know there. But, you need to get some firmware under your belt in order to understand your hardware requirements.

Take a look at the dd-wrt source code. You will actually learn a lot just trying to download the latest build.

I think you would have more fun (and it is much more realistic) if you tried to work with and contribute to the dd-wrt community. You might even be able to help them with testing.
You have a lot to learn, and that will get you inside a real router.
 
  • Like
Likes puf_the_majic_dragon and sergeyrar
  • #10
meBigGuy said:
I don't know what the best online resource is to learn C (if that is what you were thinking you would get from that link). I would look for an online lecture series, like college courses. You should search this forum's programming section, or possibly post there. For example https://www.physicsforums.com/threads/programming-resources.15689/

The link you posted is somewhat "relevant", but there is not much content there.

learning C is one thing
learning operating system functions is another
learning driver structures is another
and it goes on and on

I'm a hardware designer, so I could go on and on about what you need to know there. But, you need to get some firmware under your belt in order to understand your hardware requirements.

Take a look at the dd-wrt source code. You will actually learn a lot just trying to download the latest build.

I think you would have more fun (and it is much more realistic) if you tried to work with and contribute to the dd-wrt community. You might even be able to help them with testing.
You have a lot to learn, and that will get you inside a real router.

Thanks a lot for your help!
 
  • #11
  • #12
sergeyrar said:
It's a general guide on how to build a computer.
Not even close. It just tells you a little bit about the top level of a C program and a super simple program. It's hard for me to relate to how you arrived at that statement.

A basic computer consists of a cpu with an ISA (instruction set architecture), memory system and io system. Each of those are broken down into many sub systems. And "io system" will include mass storage, and all video/audio/communications functions, or anything else the cpu controls, each of which has numerous subsystems.

https://en.wikipedia.org/wiki/Computer_architecture
https://en.wikipedia.org/wiki/Computer_hardware
https://en.wikipedia.org/wiki/Software_architecture
 
  • Like
Likes sergeyrar
  • #13
meBigGuy I still stand by my original post. Anyone who asks a question like that with without adding what they already know clearly does not understand the depth of their endeavor. Making cookies from scratch is generally agreed upon that one goes to the supermarket to buy the basic ingredients, etc. I seriously doubt anyone would think a person would start out buying a quarter section of land and raising every single ingredient themselves. From a computer systems perspective I seriously doubt anyone considers that building a desktop computer from scratch would consist of buying the monitor, tower, speakers, mouse, keyboard, cabling, speakers, etc. and just plugging them in. A router is a pretty compact device and building it from scratch I would think cannot have many interpretations. I would think the advice given here is pretty helpful. Having never done any rock climbing or mountain climbing I would appreciate an answer that says "you don't know what you are getting into" if one day I woke up and said I wanted to climb Mt. Everist.
 
  • Like
Likes davenn
  • #14
I know it is extremely complex.
I didn't say I want it done by tomorrow.
I have a lot of free time now, so I can put the effort.. I have you. I have google.. I have brain( hope enough).
It is a challenge... and it will take me years.. I don't mind.
 
  • #15
Your problem was to use the term "from scratch"in your OP. The answer to that would have to be "you couldn't". If you had asked for something specific then you would have got some interested answers.
Don't get cross; think before you ask.
sergeyrar said:
I know it is extremely complex.
I didn't say I want it done by tomorrow.
I have a lot of free time now, so I can put the effort.. I have you. I have google.. I have brain( hope enough).
It is a challenge... and it will take me years.. I don't mind.
I have a feeling that, by the time you learn 'all' about making one, they could be old technology. These things are done by teams of Engineers, each with their own expertise (and equipment).
Why not choose a particular aspect and become a bit of an expert on that? You could easily get to know much more than other people in that particular topic.
 
  • #16
Averagesupernova said:
From a computer systems perspective I seriously doubt anyone considers that building a desktop computer from scratch would consist of buying the monitor, tower, speakers, mouse, keyboard, cabling, speakers, etc. and just plugging them in.

Actually, it's Mount Everest. :wink:

Building custom computers yourself is a niche thing, especially with hard-core gamers.

I've actually built a system in the manner you describe: I selected a motherboard, a case, a CPU, some RAM, disk drives, monitor, graphics card, etc., and assembled the whole shebang. And it worked! Still does, after almost 8 years.

If people (a lot of them) didn't want to build or customize their own computers, but just settled for what came off the shelf, businesses like Newegg.com probably wouldn't exist.

Still, wanting to build a router from scratch is a little out there. :rolleyes:
 
  • #17
I know it is kind of a wide topic ( to build a router), but I feel I'm missing something.. I don't feel like I did something great just by being an expert in a small field of something huge.
By the way..

where is the boundary of a specific field? when does one feel he crossed it?..
 
  • #18
sergeyrar said:
I know it is kind of a wide topic ( to build a router), but I feel I'm missing something.. I don't feel like I did something great just by being an expert in a small field of something huge.
By the way..

where is the boundary of a specific field? when does one feel he crossed it?..
There aren't usually any bright lines to tell you this. To some extent, accumulated knowledge can be (and is ) used in a variety of different fields.

Building a router is a little like wanting to build a bridge: if the bridge is small, you can probably pull it off. If you want to build a copy of the Golden Gate Bridge, that's a little more ambitious.

Most routers sold today are not built up from a bunch of discrete components, like resistors or single transistors, and stuff. The router function is provided by custom-designed integrated circuits and probably some software burned into a ROM. Sure, you could buy a router, take it apart, and re-assemble the components, but that's just mechanics.

It's not clear what your goal is here, except to say, "I built a router."
 
  • #19
I think I have given you a map of the landscape and we have all told you how tough the terrain is. I don't think there is anything else we can provide at this point.
You can delve into computer architecture to understand the hardware you need, and you can delve into one of the best router implementations out there, DD-WRT, to understand the firmware required. (I use DD-WRT).

The DD-WRT firmware is very router specific, and until you are capable of understanding it, you will accomplish nothing. That in itself is a huge task. The hardware is secondary, and you should limit you study there to what is required to understand the firmware (which won't be trivial)

Once you can find your way through the dd-wrt source code, you are ready to ask new questions. But, at that point, you will be talking on the dd-wrt forums, not here.

Good Luck.
 
  • Like
Likes sergeyrar
  • #20
The first thing you need is a good electric motor. It's important the rotor not wobble so it makes an even cut in the wood ...

An internet router you say? Hmm... o:)
 
  • #21
SteamKing said:
There aren't usually any bright lines to tell you this. To some extent, accumulated knowledge can be (and is ) used in a variety of different fields.

Building a router is a little like wanting to build a bridge: if the bridge is small, you can probably pull it off. If you want to build a copy of the Golden Gate Bridge, that's a little more ambitious.

Most routers sold today are not built up from a bunch of discrete components, like resistors or single transistors, and stuff. The router function is provided by custom-designed integrated circuits and probably some software burned into a ROM. Sure, you could buy a router, take it apart, and re-assemble the components, but that's just mechanics.

It's not clear what your goal is here, except to say, "I built a router."
I do it just for fun and learning, not to say "I built a router"
I think it will be fun.. and interesting.
And If I pull it off, maybe I'll start something else
 
  • #22
sergeyrar said:
I do it just for fun and learning, not to say "I built a router"
I think it will be fun.. and interesting.
And If I pull it off, maybe I'll start something else

assuming you understand the electronics and theory behind it, first I would determine what the architecture of the system is. Make a block diagram and start very simple. Make your block diagram more and more complex as you think about what needs to go into in.

Once you're done with that, break it down to hardware implementation, software implementation, etc.

If you come to a forum like this with nothing but a vague question, you'll get chewed up and spit out.
Start with the block diagram then get back to us. Once you start putting in the effort, you might find you're answering your own questions.
 
  • #23
I'm a little disappointed in most of these responses. Sergeyrar is clearly doing this as a learning exercise for fun, which means the end goal is not something nearly as complex as a Cisco 4000 ISR. I get it - I do the same thing. Why use something someone else already built when I can build it myself and learn something?

At its simplest, you could build a basic "router" with a pair of RJ45 (or RS232) jacks and a couple of programmable ICs on a breadboard. It probably couldn't handle anything more basic than simple signal transmission, barely more than a repeater, but it'd give you a great start in developing an understanding of how to receive, process, route, and transmit data signals from an incoming port to an outgoing port. Getting into actual router functions, it'd be a lot more complex to recognize and inspect incoming TCP packets, and that's probably where you'd want to open up the dd-wrt source code. Building in complexity, you can custom order printed circuit boards relatively cheap, if you want to go that far.

As far as which ICs to start with, you'll have to do some shopping. I can't really give you much advice there, but if you can sort out the physical requirements for connecting your RJ45 jack to your IC (and IC to second IC and second IC to second RJ45), and your programming requirements (the block diagram is a great suggestion) that will help you sort out what kind of IC you need.
 
  • #24
puf_the_majic_dragon said:
I'm a little disappointed in most of these responses. Sergeyrar is clearly doing this as a learning exercise for fun, which means the end goal is not something nearly as complex as a Cisco 4000 ISR. I get it - I do the same thing. Why use something someone else already built when I can build it myself and learn something?

I think a big part of the problem is that folks have been having a hard time finding out the level of the OP's electronics background. The appropriate answer varies quite a bit depending on what the OP's knowledge base is. I like the rest of your response. :smile:
 
  • Like
Likes puf_the_majic_dragon
  • #26
Thanks a lot for your help!

If I get something interesting going on, I promise to share and ask.
 
  • #27
Svein's approach if I understand it correctly would be a good way to go. You can get open source software for many of the commercial home routers, wired and wireless, and see how they work. We do this sort of thing, that is take a consumer router and modify the software for specific purposes (robotics etc). It's a good starting place.
 
  • #28
cosmik debris said:
Svein's approach if I understand it correctly would be a good way to go. You can get open source software for many of the commercial home routers, wired and wireless, and see how they work. We do this sort of thing, that is take a consumer router and modify the software for specific purposes (robotics etc). It's a good starting place.
Like I have been saying since post #6?
 
  • Like
Likes davenn, sergeyrar and nsaspook
  • #29
meBigGuy said:
Like I have been saying since post #6?
And as I said in post #4?

You should probably dissect routers and similar equipment to learn how they work.
 
  • #30
sergeyrar said:
I do it just for fun and learning, not to say "I built a router"
I think it will be fun.. and interesting.
And If I pull it off, maybe I'll start something else
What do YOU want to get out of this project. As you've seen there are many many options. Did you want to learn olny software? put together a hardware system? use an FPGA to make your own hardware?

there are many routes, so what do you want to learn and how hard do you want it to be?
 
Last edited:
  • #31
Averagesupernova said:
And as I said in post #4?

And as I said in post #27.
 
  • #32
LOL --- I was complaining about your post 27 when I quoted it in post 28. Did you even notice that? Do you even read this stuff?

I didn't count Averagesupernova's post 4 because he didn't provide any specific helpful information. (I want to build a router --- OK, study some routers)

Anyway, I think the consensus is clear. Download some router firmware and start dissecting it. I happen to like dd-wrt, but maybe there are simpler implementations to start with.
 
  • #33
meBigGuy said:
LOL --- I was complaining about your post 27 when I quoted it in post 28. Did you even notice that? Do you even read this stuff?

I didn't count Averagesupernova's post 4 because he didn't provide any specific helpful information. (I want to build a router --- OK, study some routers)

Anyway, I think the consensus is clear. Download some router firmware and start dissecting it. I happen to like dd-wrt, but maybe there are simpler implementations to start with.

I know what you were complaining about. Where I live we have a thing called humour, I know this is a foreign concept to some people and I also know that humour often doesn't translate well across national boundaries. Smile!
 
  • #34
us dummies need smilies :) or we don't know to laugh.
 
  • Like
Likes davenn

1. What materials do I need to build a router from scratch?

To build a router from scratch, you will need a microcontroller, a power supply, an Ethernet controller, a network interface card, and a router software. You may also need additional components such as resistors, capacitors, and LEDs depending on the specific design of your router.

2. Do I need any prior knowledge or experience in networking or electronics to build a router from scratch?

While prior knowledge and experience in networking and electronics can be helpful, it is not necessary. Building a router from scratch can be a great learning experience for beginners and there are plenty of online resources and tutorials available to guide you through the process.

3. How much time does it take to build a router from scratch?

The amount of time it takes to build a router from scratch can vary depending on your level of experience and the complexity of your design. It can take anywhere from a few hours to a few days to complete the project.

4. Can I customize the features and functions of my router if I build it from scratch?

Yes, one of the advantages of building a router from scratch is the ability to customize it according to your specific needs and preferences. You can choose the components, design the circuit, and program the software to include the features and functions you desire.

5. Is it cost-effective to build a router from scratch compared to buying a pre-made router?

It depends on the specific components and materials you choose to use. In some cases, building a router from scratch can be more cost-effective, especially if you have some of the necessary components already. However, if you are looking for a basic router with standard features, buying a pre-made router may be a more affordable option.

Similar threads

Replies
3
Views
2K
  • Electrical Engineering
Replies
11
Views
2K
Replies
7
Views
2K
  • Electrical Engineering
Replies
4
Views
1K
  • Programming and Computer Science
Replies
13
Views
1K
  • Electrical Engineering
Replies
3
Views
920
  • Computing and Technology
Replies
3
Views
1K
  • Computing and Technology
Replies
11
Views
2K
  • Computing and Technology
Replies
25
Views
1K
  • Electrical Engineering
Replies
5
Views
911
Back
Top