Vro configuration 2 in Linux

Source: Internet
Author: User
Article title: vro configuration 2 in Linux. 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.
Multi-Nic settings
  
Static router configuration
  
In Linux, the most common command for specifying routing rules is route. of course, some graphical tools can be used. we will introduce them one by one.
  
Use of the route command
  
The main function of the route tool is to manage route tables in the Linux kernel. It is used to set static route table items. generally, after the system uses ifconfig to configure network interfaces (such as network interfaces, it is used to set the interface through which the IP address of the host or a CIDR block should be sent.
  
The Route tool has complex call parameters.
  
The call format is as follows:
Route [-CFvnee]
  
Route [-v] [-A family] add [-net |-host] target [netmask
Nm] [gw Gw] [metric N] [mss M] [window W] [irtt I]
[Reject] [mod] [dyn] [reinstate] [[dev] If]
  
Route [-v] [-A family] del [-net |-host] target [gw Gw]
[Netmask Nm] [metric N] [[dev] If]
  
Route [-V] [-- version] [-h] [-- help]
  
The main parameters are described as follows:
-V uses the redundant output mode.
-A family
Specify a specific address family (such as "inet" and "inet6 ").
-N uses the address displayed by number (for example, 202.38.75.75) instead of interpreting the domain name.
-E uses the same output format as netstat.
-The ee parameter produces a long output, including almost all information about the kernel route table.
-Net target is a network segment.
-The host target is a separate host.
-F: displays the kernel FIB route table. The result may be changed by the-e and-ee parameters.
-C: displays the route cache information in the kernel.
Del deletes a route table entry.
Add a route table entry.
Target CIDR block or host. It can be an IP address, network, or host name.
Netmask Nm
Specifies the network mask of the route table entry to be added.
Any IP group that leads to the target of gw Gw must use this gateway.
Metric M
Set the metric field in the route table to M.
Mss M sets the maximum TCP fragment length (MSS) M bytes.
The default value is 536.
Window W
Set the size of the TCP sending window to W bytes.
Irtt I sets the TCP initialization loop time (irtt) I millisecond (1-12000 ).
The default value is 1122 ms according to RFC 300.
Install a blocking route in the reject, which may cause failed route search.
Mod, dyn, reinstate
Add or modify a dynamic route table entry. It is mainly used for testing and diagnosis.
Dev If forcibly uses a specific output interface (If), instead of the system looking for an interface.
  
The following are several configuration examples:
  
Route add-net 192.56.76.0 netmask limit 255.0 dev eth0
Add a route table entry. The network segment 192.56.76.x should go through the interface "eth0.
  
Route add default gw mango-gw
Add a default route (if there are no other matched route entries, use this routing rule ).
"Mango-gw" is a host name, and the routing rules to this host should have been set in advance.
  
Route add ipx4 sl0
Add a routing rule to the host "ipx4" and use sl0 on the SLIP interface.
  
Route command output result
  
The output format includes the following columns:
  
Destination
Destination CIDR block or host.
  
Gateway
Gateway address. if not set, it is.
  
Genmask
Network mask.
  
Some possible Flags are as follows:
U (the route is active)
H (target is a host)
G (gateway ))
R (table items generated by reinstate route dynamic routing)
D (dynamically installed by daemon or redirect)
M (modified from routing daemon or rederict)
! (Reject route)
  
Metric routing distance.
  
Ref route entry reference times. (Not used in Linux kernel)
  
Use the number of times to query route entries ..
  
Iface: the output interface corresponding to the route table entry.
  
The maximum TCP fragment size of MSS by default.
  
The default size of the TCP Window.
  
The default TCP loop time of irtt.
  
HH (cached only)
The number of ARP entries.
  
Arp (cached only)
Whether the physical address corresponding to this route entry expires or not.
  
The output instance of route-n is as follows:
  
Tarn :~ $/Sbin/route-n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
202.38.64.3 202.38.75.62 255.255.255.255 UGH 0 0 0 eth0
202.38.75.75 0.0.0.0 255.255.255.255 UH 0 0 0 eth2
202.38.75.0 0.0.0.0 255.255.255.255.128 U 0 0 eth0
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
192.168.75.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
159.226.0.0 202.38.75.62 255.255.0.0 UG 0 0 0 eth0
127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
0.0.0.0 202.38.75.62 0.0.0.0 UG 1 0 eth0
  
The above output shows that the default gateway of the router configuration is 202.38.75.62, which has three Ethernet interfaces (eth0, eth1, and eth2 ). The first and second routing rules are for one host, and the others are for one CIDR block, which can be seen by the re-mask.
  
  

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.