Static Routes in RH73 Linux

Static Routes in RH73 Linux

 

This post was last updated on June 3rd, 2020 at 04:36 pm

(Other routing page: routes.html)

Here’s how to set up Red Hat 7.3 /etc/sysconfig/static-routes file, I mention this here because this had me halted for longer than I wanted to be stuck trying to figure out how exactly this file works:

eth0 v 172.16.0.1
eth1 v 16.1.224.98
eth1 v default gw 16.1.224.1

So this system has 2 static IP addresses, 172.16.0.1 and 16.1.224.98. Looking at my route table I have:

[[email protected] root]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
16.1.224.0      0.0.0.0         255.255.252.0   U        40 0          0 eth1
172.16.0.0      0.0.0.0         255.255.0.0     U        40 0          0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
[[email protected] root]# 

So I have my loopback and the two networks, but I don’t have any host lines (UH) for the static ip addresses themselves, nor do I have a default gateway (UG), so adding the /etc/sysconfig/static-routes and restarting the networking (service network restart) I then get the following correct route information:

[[email protected] root]# netstat -rn
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
172.16.0.1      0.0.0.0         255.255.255.255 UH       40 0          0 eth0
16.1.224.98     0.0.0.0         255.255.255.255 UH       40 0          0 eth1
16.1.224.0      0.0.0.0         255.255.252.0   U        40 0          0 eth1
172.16.0.0      0.0.0.0         255.255.0.0     U        40 0          0 eth0
127.0.0.0       0.0.0.0         255.0.0.0       U        40 0          0 lo
0.0.0.0         16.1.224.1      0.0.0.0         UG       40 0          0 eth1
[[email protected] root]# 
Previous Using DD to backup your drive
Next Setting up PXE Server
 

About author

Sibananda Sahu
Sibananda Sahu 187 posts

A Linux Kernel Developer and a Firmware Developer by profession. Have worked with few big companies: BROADCOM Corporation, Cypress Semiconductor, LSI Corporation, TOSHIBA Corporation, Western Digital; on various cutting edge technologies and product lines, such as: RAID storage Driver, SSD Firmware, WLAN Firmware etc. Having more than 9 years of experience in Software Engineering domain. Now, took a pledge to educate all aspirant students to teach about Linux Kernel Development.

View all posts by this author →

You might also like

System Understanding 0 Comments

Digging into an initrd File

This post was last updated on May 27th, 2020 at 05:23 pm Please refer to rhdiskmod.html for complete information. That page will eventually replace this page. Contents1 Unpacking an initrd2

System Understanding 0 Comments

Linux /dev Entries

This post was last updated on June 1st, 2020 at 11:57 amLocated here is a listing of the /dev directory. I have posted this information since you may not always

System Understanding 0 Comments

Linux and Memory

This post was last updated on May 26th, 2020 at 10:10 pmContents1 Determining if your entire memory is being detected:2 Specifying Undetected Memory – Method #12.0.1 The following format is

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply