linux_wiki:route_ip_traffic_and_create_static_routes

This is an old revision of the document!


Route IP Traffic And Create Static Routes

General Information

Routing IP traffic and creating static routes.


Linux Routing

Show Route Table

ip route show


Create static route (NOT persistent)

ip route add 216.58.217.0/24 via 192.168.1.254 dev eth1
  • 216.58.217.0/24 → destination network
  • via 192.168.1.254 → use this gateway
  • dev eth1 → use this interface


Remove static route

ip route delete 216.58.217.0/24 via 192.168.1.254 dev eth1


Create config file

vim /etc/sysconfig/network-scripts/route-eth0
 
216.58.217.0/24 via 192.168.1.254 dev eth0
  • 216.58.217.0/24 → traffic to this destination
  • via 192.168.1.254 → use this gateway
  • dev eth0 → use this device


Restart the network service

systemctl restart network

  • linux_wiki/route_ip_traffic_and_create_static_routes.1470713946.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)