Establish a network router in Linux (3)

Source: Internet
Author: User
Article title: creating a network router in Linux (3 ). Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
Use Zebra to set network ports
  
We use the Zebra software to manage the network first by using RIP. As mentioned above, we have installed Zebra on ThinkPad. Because we need to establish another network interface on ThinkPad, we must first set a virtual network device, such:
  
# Modprobe dummy
# Ifconfig dummy0
  
Next, we can connect to the Zebra program port to start setting. Our conversation with Zebra should be conducted in the following order.
  
Port setting sequence:
  
User Access Verification
Password: zebra
Speedmetal> enable
Password: zebra
Speedmetal # configure terminal
Speedmetal (config) # interface eth0
Speedmetal (config-if) # ip address 192.168.2.1/30
Speedmetal (config-if) # quit
Speedmetal (config) # interface eth1
Speedmetal (config-if) # ip address 192.168.1.1/30
Speedmetal (config-if) # quit
Speedmetal (config) # interface dummy0
Speedmetal (config-if) # ip address 10.0.2.1/24
Speedmetal (config-if) # write
Configuration saved to/etc/zebra. conf
Speedmetal (config-if) # end
Speedmetal # show run
Current configuration:
!
Hostname speedmetal
Password zebra
Enable password zebra
!
Interface lo
!
Interface eth0
Ip address 192.168.2.1/30
!
Interface dummy0
Ip address 10.0.2.1/24
!
Interface eth1
Ip address 192.168.1.1/30
!
!
Line vty
!
End
  
Note: We didn't set IP addresses on ThinkPad as usual, but set them through Zebra. These settings are stored in the/etc/zebra. conf file. Therefore, these settings are activated whenever the Zebra service starts.
  
The main content of the zebra. conf file is as follows:
  
/Etc/zebra. conf file content
  
!
! Zebra configuration saved from vty
! 2003/08/20 00:07:51
!
Hostname speedmetal
Password zebra
Enable password zebra
!
Interface lo
!
Interface eth0
Ip address 192.168.2.1/30
!
Interface dummy0
Ip address 10.0.2.1/24
!
Interface eth1
Ip address 192.168.1.1/30
!
!
Line vty
!
  
You can also use MRLG to view the status of each network port. the specific step is to select the default status "router1", then select the "show interface" button, and click "Execute ".
  
Use Zebra to set RIP route selection
  
Because we have set the network port on the ThinkPad router, we can configure the router to synchronize it with RIP. Zebra uses different non-background interactive programs to support different routing protocols. Therefore, we must first create a simple setup file/etc/zebra/ripd. conf.
  
Basic/etc/zebra/ripd. conf file:
  
Hostname speedmetal-rip
Password zebra
Enable password zebra
  
Run ripd without background interaction program:
  
# Service ripd start
  
Then, we can connect to the 2602 interface of the Zebra router to set the RIP without background interaction program.
  
RIP settings:
  
User Access Verification
Password: zebra
Speedmetal-rip> enable
Password: zebra
Speedmetal-rip # configure terminal
Speedmetal-rip (config) # router rip
Speedmetal-rip (config-router) # network 10.0.0.0/8
Speedmetal-rip (config-router) # network 192.168.0.0/16
Speedmetal-rip (config-router) # end
Speedmetal-rip # show run
Current configuration:
!
Hostname speedmetal-rip
Password zebra
Enable password zebra
!
Interface lo
!
Interface eth0
!
Interface dummy0
!
Router rip
Network 0.0.0.0/0
Network 192.168.0.0/16
!
Line vty
!
End
Speedmetal-rip # write
Configuration saved to/etc/zebra/ripd. conf
Speedmetal-rip #
  
The/etc/zebra/ripd. conf file after setting is:
  
!
! Zebra configuration saved from vty
! 2003/08/19 13:50:30
!
Hostname speedmetal-rip
Password zebra
Enable password zebra
!
Interface lo
!
Interface eth0
!
Interface eth1
!
Interface dummy0
!
Router rip
Network 10.0.0.0/8
Network 192.168.0.0/16
!
Line vty
!
  
Create a RIP route selection on a Cisco router
  
To make the settings of the two Cisco 3620 routers easier, we name them "A" and "B". here we only make the most basic settings so that they can work properly. These settings include setting the port IP address, the return address, and the serial clock frequency used for normal serial communication.
  
Configure vroa:
  
Router # config terminal
Router (config) # hostname RouterA
Routeconfig # int s0/0
Routeconfig-if # ip address 192.168.0.1 255.255.255.252
Routeconfig-if # no shut
Routeconfig-if # interface fastEthernet 0/0
Routeconfig-if # ip address 192.168.2.2 255.255.255.252
Routeconfig-if # no shut
Roupid (config-if) # int loopback 0
Routeconfig-if # ip address 10.0.0.1 255.255.255.0
Roupid (config-if) # end
Route# write
  
You can set vrob B in the same way:
  
Router # configure terminal
Router (config) # hostname RouterB
RouterB (config) # int s0/0
RouterB (config-if) # ip address 192.168.0.2 255.255.255.252
RouterB (config-if) # no shut
RouterB (config-if) # int fastEthernet0/0
RouterB (config-if) # ip address 192.168.1.2 255.255.255.252
RouterB (config-if) # no shut
RouterB (config-if) # int loopback 0
RouterB (config-if) # ip address 10.0.1.1 255.255.255.0
RouterB (config-router) # end
RouterB # write
  
Setting RIP on vrouters 3620 is similar to setting commands in Zebra. We connect two 3620 routers through the control line and execute the following commands.
  
Set RIP for router:
  
Rouw.# conf t
Enter configuration commands, one per line. End with CNTL/Z.
Routeconfig # router rip
Routeconfig-router # network 10.0.0.0
Routeconfig-router # network 192.168.0.0
Routeconfig-router # network 192.168.2.0
Routeconfig-router # version 2
Routeconfig-router # end
Route# write
  
Set RIP for Router B:
  
RouterB # conf t
Enter configuration commands, one per line. End with CNTL/Z.
RouterB (config) # router rip
RouterB (config-router) # network 10.0.1.0
RouterB (config-router) # network 192.168.0.0
RouterB (config-router) # network 192.168.1.0
RouterB (config-router) # version 2
RouterB (config-router) # end
RouterB # write
  
The rip command of the router is mainly used to activate the RIP process. this network command informs the router of the network to which RIP will spread.
  
Use RIP to expand the path
  
Now that we have completed the configuration of the Cisco router and Zebra software, we can check the paths that are being expanded. In the MRLG status, select "show ip route" and click "Execute" to obtain some reports.
  
Use the RIP path displayed by Zebra:
  
Codes: K-kernel route, C-connected, S-static, R-RIP, O-OSPF,
B-BGP,>-selected route, *-FIB route
R> * 10.0.0.0/24 [120/2] via 192.168.2.2, eth0, 00:11:05
R> * 10.0.1.0/24 [120/2] via 192.168.1.2, eth1, 00:02:08
C> * 10.0.2.0/24 is directly connected, dummy0
K * 127.0.0.0/8 is directly connected, lo
C> * 127.0.0.0/8 is directly connected, lo
R> * 192.168.0.0/30 [120/2] via 192.168.2.2, eth0, 00:11:05
C> * 192.168.1.0/30 is directly connected, eth1
C> * 192.168.2.0/30 is directly connected, eth0
  
Paths with the R mark are obtained through RIP.
  
Zebra now recognizes two networks 10.0.0.0/24 and 10.0.1.0/24 based on vroa A and vrob B. We can run ping 10.0.0.1 and ping 10.0.1.1 on ThinkPad to check network connectivity.
  
In order to check the countermeasures for network faults, we disconnected the network connecting to Router A. after about two minutes, Zebra began to connect to the 10.0.0.0/24 network through Router B bypass.
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.