How to make static route permanent in many alternative ways?
Interesting world of linux, we get a lot of alternative approach on how to accomplish tasks, big or small.
Considering a multi-homed machine and/or machine inside VLAN with a gateway, ever wonder alternative wonder ways of making static routes permanent after reboots?
My Five SysAd Story.
There are five SysAds working with 5 different fortune companies. They all grew up in a small town, next to each other's house. And still, after all those decades, they manage to keep in touch and still befriends with one another.
One day, after a tiring Friday work they all decided to see each other and have some drink, some good old time in one bar like they used before.
Late before midnight, suddenly 5 of them begun discussing about a very simple task of creating and making static routes permanent between reboots.
Here are how their linux discussion goes....
First SysAd:
That one would be as easy as windows startup programs. Lanuch vi, and edit /etc/rc.local, put your static route commands there and you are good to go. Just make sure you have already assigned IP address for each network subnet t all your virtual ethernet interface
TRANSLATION:
The first guy was referring to these approach as follow
As all of them needs to assign static IP address first, like so
# ifconfig eth0:0 192.168.20.10 netmask 255.255.255.0 up
# ifconfig eth0:0 192.168.30.10 netmask 255.255.255.0 up
# ifconfig eth0:0 192.168.40.10 netmask 255.255.255.0 up
# ifconfig eth0:0 192.168.50.10 netmask 255.255.255.0 up
With these virtual IP aliases and assumming a single default gateway of 192.168.60.1 .
First sysad discussed to edit system boot up file /etc/rc.local
# nano -w /etc/rc.local
and add sample static routes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
route add -net 192.168.20.0 netmask 255.255.255.0 gw 192.168.60.1
route add -net 192.168.30.0 netmask 255.255.255.0 gw 192.168.60.1
route add -net 192.168.40.0 netmask 255.255.255.0 gw 192.168.60.1
route add -net 192.168.50.0 netmask 255.255.255.0 gw 192.168.60.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
then save and reboot.
Legend:
192.168.60.1 = mother gateway
192.168.20.0 = first network subnet
192.168.30.0 = 2nd network subnet
192.168.40.0 = 3rd network subnet
Second SysAd:
Man, the beer is really good and you are just putting too much of muscle energy from your finger and hands. Simply use the mouse, launch Gnome network property settings and add all the needed static routes you need from there and reboot.
TRANSLATION:
When using Gnome X, you can actually press Ctrl+F2 to execute a command. Type system-config-network to launch network property settings.
The same like System > Administration > Network using mouse movements.
Inside the newly appeared window, select the particular device interface. Click Edit menu button.
A new window appears after clicking Edit.
Go to Route tabbed menu and select Add button. From there, continue adding all the needed static routes. Click OK. Do not forget to save your static route, Ctrl+S.
Click on Deactivate and Activate to restart the new network route changes. Reboot and see.
Third SysAd, which is linux-taught by the First SysAd:
Compadres, simply edit the static route files directly and add all your static routes there. Do Network restart, that's it.
TRANSLATION:
Launch CLI terminal editor and create and edit all static route files.
# nano -w /etc/sysconfig/network-scripts/route-eth0:0
append these lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GATEWAY0=192.168.60.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.20.10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# nano -w /etc/sysconfig/network-scripts/route-eth0:1
append these lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GATEWAY0=192.168.60.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.30.10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# nano -w /etc/sysconfig/network-scripts/route-eth0:2
append these lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GATEWAY0=192.168.60.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.40.10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# nano -w /etc/sysconfig/network-scripts/route-eth0:3
append these lines
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GATEWAY0=192.168.60.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.50.10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
and restart the network like so
# service network restart
# reboot;
EDITED:
OR
# nano -w /etc/sysconfig/network-scripts/route-eth0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GATEWAY0=192.168.60.1
NETMASK0=255.255.255.0
ADDRESS0=192.168.20.10
GATEWAY1=192.168.60.1
NETMASK1=255.255.255.0
ADDRESS1=192.168.30.10
GATEWAY2=192.168.60.1
NETMASK2=255.255.255.0
ADDRESS2=192.168.40.10
GATEWAY3=192.168.60.1
NETMASK3=255.255.255.0
ADDRESS3=192.168.50.10
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# service network restart
Fourth SysAd. He does not talk too much. And linux was introduced and taught to him by the Second SysAd. So he goes
I'd probably go launching and doing it in CLI mode as well using network property settings.
TRANSLATION:
# system-config-network-tui
and follow the Second SysAd approach
The 4 of them agreed with one another. Fifth sysad was tired and already drunk. But he continues
FIFTH SYSAD
Well, what do you know, linux had kept us closer. Static routes is static-routes.
IMMEDIATE TRANSLATION:
Simply create and edit the file /etc/sysconfig/static-routes
# vi /etc/sysconfig/static-routes
and append
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
any net 192.168.20.0 netmask 255.255.255.0 gw 192.168.60.1
any net 192.168.30.0 netmask 255.255.255.0 gw 192.168.60.1
any net 192.168.40.0 netmask 255.255.255.0 gw 192.168.60.1
any net 192.168.50.0 netmask 255.255.255.0 gw 192.168.60.1
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# service network restart
That is how my Five SysAd story goes, way too different from the 5 Horsemen of Apocalypse.
Now, here's the question.
Among the 5 SysAds, which one works with RedHat company?
:)
Thanks for reading.
Subscription
Categories
- HowTos (612)
- Linux Devices (40)
- Linux Diggs (620)
- Linux News (1541)
- Linux Videos (24)
Recent Posts
Blog Archive
-
▼
2007
(340)
-
▼
August
(95)
- KCron - GUI task scheduler
- Linux backups powered by Tar
- INQ7 front page image retrieval
- using wget for data and file transfers
- BibleTime - Bible study from Linux howto
- human readable DVD/CD drive technical details
- sound-juicer - alternative audio CD ripper install
- Stellarium - watch the sky from Linux
- Munin - monitor linux hosts install howto
- blocking yahoo chat messenger
- string manipulation using cut linux command
- graphing skystream DVB receiver's Eb/No and signal...
- BZFlag - 3D multi-player tank game install howto
- screenshot and snapshot creations howtos
- string parsing using bash
- grep multiple character from string or file
- enable and disable of telnet service
- grep multiple strings from a file
- remove spaces from filenames
- ISO creation and CD/DVD burning from terminal
- send a message to user's terminal
- retrieve GMail emails via terminal using fetchmail
- more of activating and deactivating network card
- set new mysql password
- TIP: enable thumbnail display images from apache
- monitor large mailbox users
- using the linux yes command
- string manipulation using tr linux command
- install and play 2D chess game in linux
- more firefox tips and tricks
- recover root password on linux
- establish ssh connection from different port
- uniq linux command
- remove blank lines using grep or sed
- date and time sync via NTP server howto
- who am I
- delete spam email and folder regularly howto
- hello world bash and perl script
- passwordless rdesktop session with XP howto
- force VGA screen resolution and screen mode
- RealPlayer 10 for linux install howto
- Grip - CD ripper install howto
- Banshee - music management and playback
- gnome music applet install howto
- Pirut and yum-updatesd - software management
- Alacarte - editing panel menus install howto
- access NTFS drive in Fedora
- FileLight - graphical disk usage and statistics
- TestDisk- partition tool install howto
- using /dev/null in linux terminal
- yahoo messenger in fedora install howto
- check and repair MS-DOS file systems howto
- using fdformat and mkdosfs from terminal
- Tremulous - Quake 3 install howto
- block consecutive IP address using scripts
- using floppy linux command from terminal
- display word or text file in reversed pattern
- convert a file to equivalent hex/binary code
- spell check text file from terminal
- create screen timer from linux howto
- recreate deleted /dev/null
- harddisk monitoring using smartctl
- bind ssh to selected IP address
- restrict su command to superuser only
- thunderbird install howto
- dovecot POP3/POP3S server with SSL/TLS install howto
- qpopper POP3 server install howto
- my other linux pages
- more ssh log parsing and monitoring
- checking daemon service bash script
- HTML CHM help file viewer install howto
- du - the disk usage linux command howto
- gnome language translator install howto
- display linux memory information howto
- display the number of processor howto
- 3d tabletennis game install howto
- Nokia N70 on Fedora via USB data cable
- Fedora 7 as guest host from VirtualBox
- at - jobs scheduling howto
- Nokia 70 linux connection via bluetooth dongle howto
- crontab - jobs scheduling howto
- managing daemon services howto
- create your own linux OS distro howto
- kernel devel headers install howto
- more multimedia browser plugins install howto
- numlock on with X install howto
- Fedora and RHEL differences
- create virtual terminals with single ssh connection
- virtual CentOS using VMWare 5.5.4 install howto
- VMware workstation 5.5.4 install howto
- 50 quick linux command tips part 4
- 5 SysAds permanent static route story
- ssh log parsing and monitoring
- removable drives, devices and media preferences
- gnome-blog desktop blogging install howto
-
▼
August
(95)
Friday, August 3, 2007
5 SysAds permanent static route story
Subscribe to:
Post Comments (Atom)
ILoveTux - howtos and news | About | Contact | TOS | Policy
0 comments:
Post a Comment