Solve CentOS ping out of network

Source: Internet
Author: User

One. Ip

Two. Gateway

Three. Dns

Do not say, set up the local IP and mask on the line, two gateways add a default gateway, command: Route add defaule GW 192.168.1.1 This is what you use the route command to see the bottom there will be a default route, Go 192.168.1.1 Gateway, of course, this gateway is based on your local network segment decision, three is the DNS, DNS also need to modify the configuration file, #vi etc/resolv.conf file, my file default is blank. Add a DNS record on it, like I was in Henan, I added: nameserver 222.85.85.85 then save exit, OK

Ping out of the network.

By the way, let's remember a few commands:

To delete the default route:

Route command

To set and view the routing table, you can use the route command to set the command format for the kernel routing table:

# route  [Add|del] [-net|-host] target [netmask Nm] [GW GW] [[Dev] If]

which

    • Add: Adding a routing rule
    • Del: Delete a routing rule
    • -net: The destination address is a network
    • -host: The destination address is a host
    • Target: Destination network or host
    • Netmask: netmask for Destination Address
    • GW: Gateway through which routed packets
    • Dev: The network interface specified for the route
Example of using the route command

Routes added to the host

# route add-host 192.168.1.2 Dev eth0:0
# route Add-host 10.20.30.148 GW 10.20.30.40

Routes added to the network

# route add-net 10.20.30.40 netmask 255.255.255.248 eth0
# route add-net 10.20.30.48 netmask 255.255.255.248 GW 10.20.30.41
# route Add-net 192.168.1.0/24 eth1

Add a default route

# route add default GW 192.168.1.1

Delete route

# route del-host 192.168.1.2 Dev eth0:0
# route Del-host 10.20.30.148 GW 10.20.30.40
# route del-net 10.20.30.40 netmask 255.255.255.248 eth0
# route del-net 10.20.30.48 netmask 255.255.255.248 GW 10.20.30.41
# route Del-net 192.168.1.0/24 eth1
# route del default GW 192.168.1.1

Solve CentOS ping out of network

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.