Author: Ben
Experience the powerful efficiency of Cisco routing in depth
Preface
In 2000, I resigned my high salary employment in US and firmly came back to Taiwan with full IT experience in devoting myself to the service of my home country. At that time, I already have full experience of UNIX (Solaris) system administration and programming (Perl and C language). The enterprise that I served is at top 500 globally and the scope of company is across three continents (America, Europe and Asia) and dozens of countries. Their Servers are all UNIX-based extreme machine which comprises 64 CPU above and hundreds GB memory. Several specific countries possess near 100 devices mentioned above. The scope of this company is so large that it has its leading position beyond some famous global enterprise.
Five years ago, I studied many Linux HOWTO and advanced network routing documents because of the job requirement. Also I used to compile TCP/IP with C language and write networking protocol by myself so that I have strong confidence toward networking fundamentals. One day a foreign network company wanted me to apply for their job. At that time I was really full of confidence and thought the job application would be very successful. However, the whole interview was really out of my expectation. The interviewer gave me a test containing 76 questions but I only answered 15 correctly. This result really insulted me! As a result, I resolutely determined to concentrate on learning ‘real’ networking fundamentals. This story tells us one truth as Confucius has said, “Knowledge, like a sea, is boundless”.
I’ve seen many students from initiate to high level in my six-year Linux teaching experience. Like I said in the last issue of Linux Guide, I feel the essential networking knowledge of system engineer, compared to the one of network engineer, is very weak as the distance between kindergarten and college. As a result, in this document, I want to help readers reinforce their network routing fundamentals via the combination between Linux and Cisco Router.
Equipment:
Software:
Essential knowledge:
Routing
Routing refers to “the act of moving information across an internetwork from a source to a destination”. In other words, based on OSI reference model, packets are transmitted via OSI Layer 3 (Network Layer) when PC(A) transfers data to PC(B). If we look OSI model further, Layer 1 (Physical Layer) and Layer 2 (Data Link Layer) construct network skeleton and meanwhile every PC is located by MAC address (Physical Address), i.e. the address on the NIC. On the contrary, Network Layer provides “functional and procedural means of transferring variable length data sequence from source to destination and performs routing functions”. Here every end point is defined by IP protocol (Virtual Address). As the growth of Internet has increased the numbers of users accessing information around the world, Network Layer plays an important role in managing this connectivity. No doubt Cisco Systems, Inc., the most important network device manufacturer worldwide, benefits the growth of IP addressing very much. The role of IP address can be regarded as home address in mail system. Receiver can accept information from sender and respond it according to mail address. Thus, routing plays the same role as post office in achieving the destination of data transit between PCs.
Why we need routing
We cannot efficiently transfer our information without routing. In this section we will explain why we need routing via the understanding of mail system in daily life. For example, if we want to send a postcard to our friends in Brooklyn, New York, we need to write the address of both sender and receiver. Then Taiwan post office will trnasmit this postcard to New York post office and finally our friends in Brooklyn will receive it according to receiver’s address. Here arises a question: if I’m in Zuoying, Kaohsiung, what is the next step of mail transmitting when my postcard arrives in Zuoying post office? Will it be transmitted to Tainan or Taipei post office next? Actually, mail system can be regarded as a large network. Every post office is in charge of transmitting mails and chooses the most efficient route to send these mails to receivers via different post offices around the world, that is to say, these post offices exactly perform routing function. Thus, back to our discussion of routing, Router, one of the network devices that construct network skeleton, like the post office, constantly transmits packets to the next one until packets arrive in destination.

Linux route
The output of Linux routing table via running ‘route –n’ is shown as follows:

The following table represents every item’s definition in routing table:
| Item | Definition |
|---|---|
| Kernel IP routing table | IP routing table inside kernel |
| Destination | Destination IP address (Network Address) |
| Gateway | Gateway IP address |
| Genmask | Destination subnet mask |
| Flag | Routing status |
| Metric | Hop numbers to destination |
| Ref | Reference numbers of routing rule |
| Use | Packet numbers referring to current routing rule, only shown in ‘route –c’ or ‘route –F’ |
| Iface | Interface |
Every horizontal line represents one routing rule then totally combined as one routing table. Most system engineers only refer to Destination, Gateway, Iface and Genmask. Packet will be automatically matching every routing rule according to longest match when arriving in Linux machine. Every routing rule also includes transferring interface (Iface) in deciding which interface the packets should be transferred to.
Routing classification
Generally speaking, Linux route, which belongs to static route, is the routing rule that is produced by system administrator who adds it manually by running route command. On the contrary, dynamic route is produced by routing rule exchange between different machines via Routing daemon. Additionally, RIPv1, RIPv2, IGRP, EIGRP, OSPF, ISIS and BGP are all common routing protocol. Thus, if we use static route, we have to type in hundreds of routing rule on every router when we have hundreds of routers on network. It not only takes us much time but results in much trouble in changing IP address afterwards. As a result, only dynamic route can provide efficient exchange of routing rules. Dynamic route protocol has two main types: Distance-Vector and Link State. Due to page limitation, we won’t introduce the difference of these two protocols in this document. If for any further interests, please refer to Cisco CCNA program.
Introduction to RIP (Routing Information Protocol)
RIP is a very early routing information protocol belonging to Distance-Vector based on UDP in exchanging routing information via port 520. In 1982 RIP was first developed in BSDv4.2 (Berkeley System Distribution) of UC Berkeley and gradually became prevalent in Internet.
RIP(Routing Information Protocol
(Attention: Please run ‘iptables –F’ or ‘iptables –X’ to remove firewall rule on Linux iptables.)

Readers can first preview the network topology above in realizing how to make PC(A) exchange information to PC(B) via routing rule addition on network device. It will not only help you understand network fundamentals very much but much more familiar with the following experiment procedures.
Hint: We cannot implement ping between PC(A) and PC(B) without additional configuration.
IP addressing and IP routing table of each device are shown as follows:
Linux NAT:

NAT configuration:

Linux router:

Cisco_2621:
Interface IP addressing:

Routing table:

At last issue (Issue 11), we have introduced Switch configuration so it won’t be repeated here.
Next, please utilize ‘ping’ to examine whether the connection of each device is workable. If it works, then try to run ‘ping’ to examine the connection status of Linux router via Linux NAT.

As the figure above shows, we find out the connection doesn’t work. Such experimental environment is what we want.
Preparing Linux device
There are several famous routing programs on Linux machine, including routed, zebra, gated and etc. In this document, we choose zebra because most engineers use such refined program on Linux-based network devices in industry and it is definitely dependable. Additionally, zebra interface has highly similarity with Cisco IOS so it saves much time on adaptation for Cisco engineer.
The Linux platform in this document is RedHat9 and zebra RPM is zebra-0.93b-1.i386.rpm. If you don’t have zebra in your Linux platform, please install it immediately otherwise the following experiments cannot be implemented. You can see the configuration and execution included in zebra-0.93b-1.i386.rpm.

Zebra configuration is ‘/etc/zebra/zebra.conf’ but it has no content inside after installation. Thus, we can copy the sample file in ‘/usr/share/doc/zebra-0.93b/zebra.conf.sample’ to ‘/etc/zebra’ and rename as ‘zebra.confg’ in ‘/etc/zebra/zebra.conf’. Besides, there are some sample files in ‘/usr/share/doc/zebra-0.93b/’. Please make a copy to ‘/etc/zebra’ and remember to delete extension ‘.sample’.

Next, we can implement zebra routing program and examine whether zebra exists in execution table.

If readers can see the output above, it means it’s workable.
The advantage of zebra is that it is very similar to Cisco IOS interface and its configuration ‘/etc/zebra/zebra.conf’ is different from other program that is required to be edited manually by editor, e.g. vi. Also it can be changed via zebra control interface. Once zebra starts, it will regard to port 2601 demand. Therefore, we can enter in zebra control interface via telnet command connected to local host port 2601. Password is zebra.

If you see the figure above, you have succeeded in entering in zebra control interface. Readers can also enter ‘?’ or run ‘list’ then all usable commands will be listed. If for saving configuration, readers can just run ‘write memory’ in enable mode.

Next, we will start dynamic route. Zebra supports various routing protocols including RIPv1, RIPv2, RIPng, OSPF, OSPF6, BGP4+ and BGP4-. In this document, we choose RIPv2 for our RIP in this experiment. Besides, there is one daemon named as ‘ripd’ in zebra RPM and its configuration file is ‘ripd.conf’. In the previous procedure, we have copied ‘ripd.conf.sample’ to ‘/etc/zebra’ and renamed it as ‘ripd.conf’. This daemon supports both RIPv1 and RIPv2. Thus, we can just start ripd.
Please ensure that zebra daemon has been started before ripd starts. Ripd is also a daemon per se whose port is 2602 (password: zebra) while the password in unnecessary in enable mode. Then run ‘show running’ to see the configuration.


Next, we have to obey the following procedures to start RIPv2:
1) Start RIPv2 and enter in configuration mode (enter ‘configure terminal’). Then run ‘router rip’ to start RIP. Though RIP default is 2nd version in zebra, we still recommend you to run ‘version 2’ again to select RIPv2 execution.

2) Select routing destination that RIP requires. Please run ‘router rip’ to enter in control mode and then run ‘network’ to select IP address and interface of routing destination that RIP requires.


3) Then we can use ripd debug mode to examine RIP behaviors. First, please start it by running ‘terminal monitor’ command then debug message will be represented on current terminal. Next we can see RIP execution status by running ‘debug rip events’.

Readers should see one multicast address 224.0.0.9 in debug message. Many RIPs have their own regulated multicast address to transfer routing information. Here we would like to remind you that network application is not merely on IP addressing and routing.
Exercise: Please configure Linux router and experience the questions that you will encounter during lab implementation.
Cisco 2621 Router configuration
Compared to RIP configuration on Linux, Cisco router configuration is much simpler. Moreover, reader have practiced all configure command on zebra so you should be familiar with Cisco device. Procedure is as follows:
1) Start RIP

2) Examine whether there is one routing rule which starts with R in routing table. If it does, it means Cisco 2621 Router succeeds in exchanging routing information with Linux NAT via RIP.

As the figure above shows, we can see Cisco 2621 Router has obtained the routing rule ‘10.1.32.0’ on Linux NAT via RIP and added it to its own routing table.
Result
Now let’s see the difference between the routing table on current devices and the one on previous lab environment in Section 7.
Linux NAT:

Linux router:

Cisco 2621 Router:

Here we can see all devices have new added routing rules via RIP so that Linux NAT can ping 192.168.20.1 and 192.168.30.1.

Linux router can also ping other devices on Internet.

Experiment completes!
Conclusion
Through the Linux and Cisco device configuration, we have succeeded in making dynamic route between Cisco 2621 Router and Linux machine and resolving the trouble of manual static route configuration.
During this experiment, readers can easily realize Linux can support all kinds of RIP in depth. Due to page limitation, I have no time to introduce advanced routing configuration, such as OSPF and BGP. However, I believe most Linux initiates cannot quickly digest such advanced routing fundamentals.
In my opinion, Linux is a complete platform for network device. We can see many extensive manufactures based on Linux platform among other products in industry. These newly established companies often think very unique ideas in separating other manufacturers and create equipments that conform to enterprise and customer demand. Besides, the usage of Linux platform also benefits ‘Time to Market’ very much. Thus, because of Linux, numerous startups successively enter into stock market so that they quickly make a fortune and obtain a large dividend. Eventually, the only thing they have to do is just enjoy this successful glory.
Accordingly, I always tell my students that Linux definitely has numerous applications and developments in many aspects. Thus, Linux talents have many job opportunities in the future and they don’t have to worry other candidates will replace their occupation. Do not hesitate yourself, my friend! Study Linux right now! Let me teach you how to arrange your suitable course program. If you decide to start learning Linux from nowadays, one day you will become a Linux expert and easily get your ideal job.