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 241 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

Rsync and Linux

This post was last updated on July 9th, 2020 at 04:32 pmThis is how the rsync command works: cd /var/ftp/pub/rsync/; rsync -azvx dest_server::ftp . This is how to generate keys

System Internals 0 Comments

Digging into an initrd File

This post was last updated on November 3rd, 2020 at 06:08 pm Please refer to Redhat disk mod for complete information. That page will eventually replace this page. Contents1 Unpacking

System Internals 0 Comments

Printer Ports

This post was last updated on June 3rd, 2020 at 04:07 pmCommon Printer port settings are as follows: LPT Port I/O Address LPT1 378 LPT2 278 LPT3 3BC Compaq Servers

0 Comments

No Comments Yet!

You can be first to comment this post!

Leave a Reply