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

shibaa987
shibaa987 269 posts

Linux kernel developer and a firmware developer with an experience of 10+ years.

View all posts by this author →

You might also like

System Internals 0 Comments

Linux Loop Devices

This post was last updated on November 3rd, 2020 at 06:14 pmBy default you have 8 loop devices (loop0 – loop7). You can extend this number up to 255 (maybe

System Internals 0 Comments

The Differences Between UEFI And BIOS

BIOS and UEFI both are the firmware interfaces that act as an interpreter between the system’s firmware and operating system. A firmware interface initializes the hardware components while the startup

System Internals 0 Comments

Difference Between MBR And GPT

Large storage disks usually have logical partitions. An Operating System uses a partition table to identify the start address, filesystem information, and other details of a specific logical partition. The

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply