Linuxでスタティックルート追加(RedHat8,RedHat9,AS4)




RedHat8,RedHat9,AS4でスタティックルートを設定する方法は以下の通り

2.2.2.24/29宛の通信を1.1.1.20へ向けたいとする

○GUIで変更する場合

# redhat-config-network

ネットワーク設定用GUIメニューが起動するので、
設定したらインターフェースを再起動して設定を反映させる

参考までに、
上記の設定の結果、「/etc/sysconfig/network-scripts/route-eth0」が作成されている
(eth0と同一のネットワーク上に1.1.1.20がある場合) ファイルを見てみると、
2.2.2.24/29 via 1.1.1.20

○手動で変更する場合
「/etc/sysconfig/network-scripts/route-eth0」を作成および変更する
(eth0と同一のネットワーク上に1.1.1.20がある場合)
# vi /etc/sysconfig/network-scripts/route-eth0
2.2.2.24/29 via 1.1.1.20

忘れずに権限も設定する
# chmod 600 /etc/sysconfig/network-scripts/route-eth0
# chown root:root /etc/sysconfig/network-scripts/route-eth0

ネットワークインターフェースを再起動して、反映
# /etc/init.d/network stop
# /etc/init.d/network start