Android operation route table

Source: Internet
Author: User

Additional instructions;

Sometimes the Android system does not recognize the route command, you can add an "ip" before the command. What is the specific reason?

If you know it, please reply to your post. Thank you.

View route table:
CAT/proc/NET/route

Add a route entry:
IP Route add 10.0.0.2/32 Dev tiwlan0

Delete A route:
IP Route del 10.0.0.2/32

Three methods for adding soft routes in Linux
Three methods for adding soft routes in Linux: route add-net 172.16.6.0 netmask subnet mask 255.0 GW 172.16.2.254 Dev eth0/* Add a network 172.16.6.0/24 after 172.16.2.254 eth0 * // *-NET add network-host add host netmask subnet mask GW gateway Dev device, device, here is your Nic name */route del GW 172.16.2.254/* delete default gateway 172.16.2.254 */route del-net 172.16.86.0/24/* delete default network 172.16.86.0 */route/* display current route table */This method is commonly used, however, when you delete a route or a soft route, it does not take effect.
Display: siocaddrt: unable to access the network. Therefore, you can use the following method: the implemented functions are the same as the above IP Route add 172.16.6.0/24 Via 172.16.2.254 Dev eth0ip route del GW 172.16.2.254ip route del 172.16.6.0/24 Dev eth0ip route

Method To delete: Add a route:

Route add-net 10.0.0.0 netmask route 0.0.0 Dev eth0

Delete A route:

Route del-net 10.0.0.0 netmask 255.0.0.0 Dev eth0

Add default route:

Route add default GW 10.0.0.1

Delete default route:

Route del default GW 10.0.0.1

Or

Route del default ------------------------------- how to add a route in Linux:

I. Use the route command to add

If you use the route entry added by the route command, the route becomes invalid after the machine is restarted or the NIC is restarted. The method is as follows:

// Route entry to the host

# Route add-host 192.168.168.110 Dev eth0

# Route add-host 192.168.168.119 GW 192.168.168.1

// Route added to the network

# Route add-net IP netmask mask eth0

# Route add-net IP netmask mask GW IP

# Route add-net IP/24 eth1

// Add a default gateway

# Route add default GW IP

// Delete a route

# Route del-host 192.168.168.110 Dev eth0

Ii. How to set a permanent route in Linux:

1. Add in/etc/rc. Local

Method:

Route add-net 192.168.3.0/24 Dev eth0

Route add-net 192.168.2.0/24 GW 192.168.3.254

2. Add to the end of/etc/sysconfig/Network

Method: Gateway = GW-IP or gateway = GW-Dev

3./etc/sysconfig/static-router:

Any net x. x/24 gw y. Y

The third kind of soft Routing System zebra is a TCP/IP routing software which supports BGP-4, BGP-4 +, ospfv2, ospfv3, r1_1, r1_2 and ripng. It complies with the gnu gpl standard and can run on Linux and other unix variant systems. Zebra is one of the most advanced routing software. The latest version can be downloaded from the gun zebra web site.

Basic settings of zebra

Zebra has no background InteractionProgramIs a real route management program. It controls other software modules and provides master ports for interaction with customers. The zebra RPM kit contains a complete reference setting file. However, you only need to create a/etc/ZEBRA/zebra. conf file that includes the following content to set zebra.

The simplest zebra setting file:

Hostname speedmetal

Password zebra

Enable Password zebra

Whenever you enter the interactive setting mode, the hostname command specifies the name of the vro. This name can be set at will, and may not match the host name. The PASSWORD command determines the logon password of the interactive zebra terminal.

After/etc/ZEBRA/zebra. conf is created, run the following command to start the zebra non-Background interaction program:

# Service zebra start

Now we can enter the zebra Interactive dialog mode by connecting to port 2601 of the machine.

Zebra dialog mode instance:

[Root @ speedmetal Zebra] # telnet 127.0.0.1 2601

Trying 127.0.0.1...

Connected to 127.0.0.1.

Escape Character is '^]'.

Hello, This is Zebra (version 0.93b ).

Copyright 1996-2002 kunihiro Ishiguro.

User Access Verification

Password: Zebra

Speedmetal> enable

Password: Zebra

Speedmetal #?

Configure configuration from vty Interface

Copy copy configuration

Debug debugging functions (see also 'undebug ')

Disable turn off privileged MODE Command

End end current mode and change to enable mode.

Exit exit current mode and down to previous Mode

Help description of the interactive help system

List print command list

No negate a command or set its defaults

Quit exit current mode and down to previous Mode

Show show running system information

Terminal set terminal line parameters

Who display who is on vty

Write write running configuration to memory, network, or terminal

Speedmetal #

We can easily understand this, because we can click on the screen? Key to understand the meaning of a command at any time. If you have configured a Cisco Route

So far, we have only completed the setting and running of zebra, and the setting of various protocols has not started yet. If you are ready, let's continue.
Case 1

2. Network Planning

The vrolinux in Linux has two NICs, etho: 192.168.1.1 and eth1: 192.168.10.1.

The CIDR block of Client A is 192.168.1.0/24 and the IP address is 192.168.1.2. The CIDR block of client B is 192.168.10.0/24 and the IP address is 192.168.10.2.

3. Configure vro network settings

Because the router in Linux must be virtualized out of two NICs, respectively as two different network segment of the gateway, so the following directory will see two files, respectively, ifcfg-eth0 and ifcfgethl. They are the configuration files of two NICs.

First edit the ifcfg-eth0, let it address 192.168.1.1, details are as follows:

[Root @ rhel5 ~] # Vi/etc/sysconfig/network-scripts/ifcfg-eth0

Device = eth0

Onboot = Yes

Bootproto = static

Ipaddr = 192.168.1.1

Netmask = 255.255.255.0

Next edit the ifcfg-eth1, let it address 192.168.10.1, the details are as follows:

Device = eth1

Onboot = Yes

Bootproto = static

Ipaddr = 192.168.10.1

Netmask = 255.255.255.0

Restart the network service to make the network configuration take effect.

If the preceding operations are correct, install and configure the vro. First we need to download a zebra-0.95b-1.i386.rpm, the router program under Linux, there is this RPM package in the RedHat CD. If you are using another version of Linux, you can download to the http://www.findrpm.com. So far, zebra has been successfully installed. Check whether the installation of zebra is successful:

[Root @ rhel5 my] # rpm-AQ | grep zebra

Zebra-0.95b-1

The above result indicates that the installation is successful. Start Zebra now:

[Rot @ rhel5 my] # service zebra start

[Rot @ rhel5 my] # service ripd start

The ripd process is mainly used to use the zebra configuration to support the rip routing protocol. Therefore, you must not only start zebra, but also start ripd at the same time. If you want to automatically run the vro after the next boot, run the following command:

[Root @ rhel5 my] chkconfig zebra on

[Root @ rhel5 my] chkconfig ripd on

Let's take a look at the configuration file of zebra:

[Root @ rhel5 Zebra] # ls

Ripd. conf vtysh. conf zebra. conf

AboveCodeVtysh. conf is the shell configuration file used to configure zebra, and zebra. conf is the main configuration file of zebra.

Configuration is required to enable communication between machines in the 192.168.1.0/24 and 192.168.10.0/24 network segments. If you have used Cisco routers, zebra is easy to use, because their commands are almost the same. Configure the client.

4. Configure the network settings of the Client

Configure client a first. Modify the ifcfg-eth0 with the following content:

Device = eth0

Onboot = Yes

Bootproto = static

Ipaddr = 192.168.1.2

Netmask = 255.255.255.0

Gatway = 192.168.1.1

Note that you must set the Gateway as the 192.168.1.1 gateway of the router.

[Root @ rhel5 my] # service network restart

After the network service is restarted, the configuration of Customer A is complete. Configure client B. The method for configuring B is actually the same as above, but there are two differences. Set the IP address of client B to 192.168.10.2 and the gateway to 192.168.10.1. These two points are different.

Other route adding methods:

Route add default Dev Device
Route add default gw ip Dev Device
Route add-net IP netmask GW IP

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.