UX Techno

Platform for learning UNIX & LINUX technologies

  • Home
  • Post Index
  • Contact US!
  • Privacy Policy

Linux route addition

Route.

Route keeps the data about the routing table. Main use of the Route is to have the static routes to network using an interface which has been configured by ifconfig command.

For adding the route to the network follow below steps

A. Check the current routing information.

  1. # route -n
  2. Kernel IP routing table
  3. Destination Gateway Genmask Flags Metric Ref Use Iface
  4. 10.41.42.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
  5. 10.41.41.0 10.41.42.8 255.255.255.0 UG 0 0 0 eth0
  6. 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
  7. 0.0.0.0 10.41.42.1 0.0.0.0 UG 0 0

B.To add a route refer to the command below.

"route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8"

C. To delete a route refer to the command below.

"route del -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8"

D.To make the rounting information persistent after reboot.

The routing information above is not persistent across reboots. After a reboot, the routing information will be lost and you need to add them in again. To make the routing information persistent, add the “route add” line as seen above into the /etc/rc.local file.

  1. #!/bin/sh
  2. #
  3. # This script will be executed *after* all the other init scripts.
  4. # You can put your own initialization stuff in here if you don’t
  5. # want to do the full Sys V style init stuff.
  6. touch /var/lock/subsys/local
  7. route add -net 10.41.41.0 netmask 255.255.255.0 gw 10.41.42.8

To Know all the topics related to LINUX please click below link.

Linux Topics.

If this post helped you by any means, then Please
Support Us! by making Payment Payment Link.
Subscribe For RSS Feed::Here.
Like my facebook page FaceBook Page
Follow Us on Twitter:: Twitter
Follow Us on YouTube:: YouTube
  • Facebook
  • RSS
  • Twitter
  • YouTube






Categories

  • AWS (26)
  • devops (15)
  • Extra (1)
  • Helm (2)
  • HPUNIX (4)
  • Kali Linux (2)
  • Kubernetes (7)
  • Linux (100)
  • LVM (4)
  • Python (2)
  • Ubuntu (3)
  • Uncategorized (4)

Subscribe to our mailing list

* indicates required

Subscribe to our mailing list

* indicates required


Subscribe to our mailing list

* indicates required


© 2016 UxTechno. The content is copyrighted to Manmohan Mirkar and may not be reproduced on other websites.