Create a router record using Quagga (Zebra) in Linux
Preface
From noon on the 22nd, I had no clue about the usage of zebra/quagga. Various Google and Baidu are almost collapsed. Since the configuration methods of zebra/quagga on the Internet are all implemented on several real computers, we have never found any tutorials for testing on virtual machines. Therefore, I decided that if I could use multiple virtual machines to complete the experiment content, I would have to write a detailed document and put it on my blog.
There is no way, simply start exploring it slowly, but it took a day to complete. It wasn't until I went to bed that I suddenly thought, will it be related to my setting up NAT-based networking on Virtual Box? Therefore, it was later changed to the Bridge Mode. After the test on the 23rd, it was finally achieved some results. On the 24th, I am familiar with how to build a vro. Although it took a long time and took more than N detours, I still learned a lot. I have been reading "Computer Network" for a few days, but actually reading books does not give me much knowledge. However, after learning how to build a Linux router, I have essentially deepened my understanding of "Computer Network.
I have been trying to improve this document. It takes a lot of time to write a good document and add typographical content. However, you can learn a lot.
Okay, let's talk about the following labs. I only wanted to build a vro experiment related to zebra/quagga, but I thought that since I was in touch with this thing, why don't I learn one more way? Therefore, the following Static Routing router is built using the most basic system tool or directly modifying the configuration file. The experiment related to zebra/quagga is put in the experiment of creating a dynamic route router. It demonstrates how to build a router using two kinds of routing protocols: r12002 and OSPF.
Use verification on Quagga to reinforce BGP Session Security
Preview knowledge
Before creating a vro, you need to know some basic knowledge. Here we will discuss one by one.
1. What is a route table and what types of Route tables are generated?
A: The route table refers to a table stored on a router or other Internet network devices. The table contains the path to a specific network terminal. In some cases, there are also some measurements related to these paths.
In Linux, route tables are arranged from small networks to large networks. We can use route-n to view the route table on the host. See the following: route table generation type:
Static route table:The system administrator sets a fixed route table in advance, which is called a static route table. It is generally set in advance according to the network configuration during system installation, it will not change as the network structure changes in the future.
Dynamic Route table:A Dynamic route table is a route table automatically adjusted by the router according to the running status of the network system. The router automatically learns and remembers network running conditions based on the functions provided by the Routing selection Protocol (Routing Protocol), and automatically calculates the optimal data transmission path as needed. A Router usually depends on the route table created and maintained to determine how to forward data. 2. What is a router? A: In a LAN, a host can send network data packets by means of broadcasting, but it must be implemented through a router when hosts of different network segments want to connect to each other.
A Router, also known as a Gateway, is used to connect multiple logically separated networks. A Logical Network represents a separate network or a subnet. When data is transmitted from one subnet to another, the router routing function can be used. Therefore, the router can determine the network address and select the IP path. It can establish flexible connections in Multi-network interconnection environments, A vro can connect to different subnets using different data groups and media access methods. The vro only accepts information from the source station or other routers and belongs to an interconnected device at the network layer.
In Linux, the route table and packet forwarding functions are provided by the Linux kernel. In our Ubuntu14.04 system, the packet forwarding function is disabled by default. There are two methods to enable:
The first method is echo 1>/proc/sys/net/ipv4/ip_forward, but such modification fails after the system is restarted.
The second method is to edit the/etc/sysctl. conf file, find the net. ipv4.ip _ forward = 1 line, and then remove. In this way, it can be done once and for all. For specific methods, see the following:
3. What is a network card? In Linux, how does one view the NIC information?
A: The network adapter is a network that works at the link layer. It is an interface connecting computers and transmission media in the education network. It not only achieves physical connection and electrical signal matching with the LAN transmission media, it also involves frame sending and receiving, frame encapsulation and unblocking, media access control, data encoding and decoding, and data cache functions.
In Linux, how do we view the NIC information? Use the ifconfig command. Eth indicates the ethernet card. See the following. You can see that an Ethernet Card eth0 on my computer can see its hardware address, IP address, and other information.
4. What are IP addresses, network segments, gateways, and subnet masks? In Linux, how should we view and modify these parameters?
A:
IP Address: IP Address (English: Internet Protocol Address) is a way to Address hosts on the Internet, also known as Internet Protocol Address. Common IP addresses include IPv4 and IPv6. The IP address addressing scheme divides the IP address space into five categories: A, B, C, D, and E. Class A, B, and C are the basic classes, and Class D and Class E are used as multicast and retained.
CIDR Block: the part in which a computer network uses the same physical layer device (transmission medium, repeater, Hub, etc.) for direct communication. That is, the IP address ranges from one to another, for example, 192.168.1.1 to 192.168.1.254. Gateway: Gateway, also known as the inter-network connector and Protocol converter. The default gateway implements network interconnection at the network layer. It is the most complex network interconnection device and is only used for different network interconnection between two high-level protocols. The structure of the gateway is similar to that of the router. The difference is the Interconnection layer. Gateways can be used for both Wan and LAN interconnection. Today, many local networks use routes to access the network. Therefore, the gateway is usually the IP address of the router.
Subnet mask: The subnet mask (subnet mask) is also called the network mask, address mask, and subnetwork mask, it is used to indicate which bits of an IP address are the subnet of the host and which bits of the host are the mask of the host. The subnet mask cannot exist independently. It must be used together with the IP address. The subnet mask has only one function, namely dividing an IP address into a network address and a host address.
In Linux, we can use the ifconfig command to view the IP address, subnet mask, and other information of the NIC. See question 3. You can use the route-n command or the netstat-r command to view the gateway information.
There are usually two ways to modify information such as IP addresses and subnet masks. One way is through the command line, that is, using commands such as ifconfig and ip route add (for details about how to use these commands, you can view them using man or help commands, however, modification via command line is not always done, and they will be restored after the system is restarted. Therefore, another method is to directly modify the configuration file. For configuration files, Ubuntu is mainly implemented by modifying the/etc/network/interfaces file. The subsequent experiment will show the modification method.
5. What is the RIP Protocol? What is the relationship between r1_1 and r1_2 protocols?
A: This old but simple routing protocol will be used in the subsequent dynamic routing setup experiment. Therefore, we should know the basic knowledge of this agreement in advance. The RIP Protocol is an Internal Gateway Protocol (IGP). It is a dynamic routing protocol used to transmit route information in autonomous systems (. Based on the Distance Vector Algorithm (DistanceVectorAlgorithms), RIP uses the number of hops (metric) to measure the route distance to the target address. Vrouters of this Protocol only care about the world around themselves and only exchange information with their adjacent vrouters. The range is limited to 15 hops (15 degrees. After more than 15 hops, you will not be able to arrive. Currently, the RIP Protocol has two versions: r1_1 and later r1_2. RIP-1 is a Classful Routing Protocol that only supports publishing Protocol packets in broadcast mode. This Protocol packet cannot carry mask information. It can only identify routes of natural network segments such as A, B, and C. Therefore, RIP-1 does not support Discontiguous Subnet ). RIP-2 is a Classless Routing Protocol ). Compared with its predecessor, it has more advantages, such as support for Route marking and flexible control of routes based on Route marking in routing policies. Because zebra supports two versions of the RIP Protocol, it is easy to build a router. The r12002 protocol will be used in subsequent experiments. Quagga seems to use the r12002 protocol by default, and zebra should be specified. 6. What is OSPF? What are the advantages?
A: OSPF (Open Shortest Path First) is an Internal Gateway Protocol (IGP) used in autonomous systems, AS. It is an implementation of the link status routing protocol, which is affiliated to the Internal Gateway Protocol (IGP) and therefore operates within the autonomous system. The famous dikplus algorithm is used to calculate the Shortest Path Tree. Compared with RIP, OSPF is a link state protocol, while RIP is a distance vector protocol.
It has many advantages, such:
1. OSPF is a real LOOP-FREE (no routing self-ring) routing protocol. Derived from the advantages of the algorithm itself. (Link status and Shortest Path Tree Algorithm)
2. Fast OSPF convergence: route changes can be transmitted to the entire Autonomous System in the shortest time.
3. The concept of area Division is proposed. After the autonomous system is divided into different regions, the route information digest between regions greatly reduces the number of route information to be transmitted. In addition, the routing information does not expand rapidly as the network size expands.
4. Minimize the Protocol overhead.
5. Provide more trusted routing choices by strictly dividing the route levels (which can be divided into four poles.
6. Good security. ospf supports interface-based plaintext and md5 verification.
7. OSPF can adapt to a variety of networks, with a maximum of thousands.
7. What is the BGP protocol? What are the main features?
A: The BGP protocol is the Border Gateway Protocol. The above two protocols, RIP and OSPF, belong to the internal gateway protocol.
Border Gateway Protocol (BGP) is a routing protocol for autonomous systems running on TCP. BGP is the only protocol used to process networks like the Internet. It is also the only protocol that can properly handle multi-channel connections between related routing domains. BGP is built on the experience of EGP. The main function of the BGP system is to exchange network accessibility information with other BGP systems. Network accessibility information includes information about the listed autonomous systems (. This information effectively constructs the topology of the AS interconnection, removes the routing loop, and implements policy decision-making at the AS level.
Four groups are used for BGP routing protocol execution: open, update, keepalive, and notification ).
BGP has the following main features:
1. Use Attribute to describe the path, instead of the cost value;
2. Using TCP (Port 179) as the transmission protocol inherits TCP reliability and connection-oriented features;
3. Check the TCP connection through Keepalive information;
4. Rich attribute features to facilitate policy-based routing;
5. Have your own BGP table;
6. Support VLSM and CIDR;
7. Suitable for use in large networks.
For more details, please continue to read the highlights on the next page:
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- Next Page
|