Redhat Routing with ip Command

ip command can be used as follows below:Show / manipulate routing

Show / manipulate devices

Policy routing

TunnelsIela

Type the following command to display:

$ ip route show

OR

$ ip route list

Sample Outputs:

10.0.5.30 dev ppp0 proto kernel scope link src 10.1.5.30

192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.1

192.168.33.0/24 dev ra0 proto kernel scope link src 192.168.33.60

default via 192.168.2.1 dev ra0 metric 100

Set a Route to the Locally Connected Network

Type the following command to sent all packets to the local network 192.168.1.0 directly through the device ens192:, enter:

# ip route add 192.168.1.0/24 dev ens192
Set a default route

All network packets that cannot be sent according to the previous entries of the routing table are sent through the following default gateway

# ip route add default via 192.168.3.254
Delete route from table

Type the following command

# ip route delete 192.168.2.0/24 dev ens192

How do I verify routing configurations?
Use the ping/host commands to make sure you can reach to your gateway:

ping Your-Gateway-Ip-Here

ping Your-DNS-Server-IP-Here

ping 192.168.3.254

ping http://www.google.com

host http://www.google.com
Source:ip route rhel 7

Advertisements