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