Reference Link: Implementing Persistent Host and Network Routes on Solaris Systems
root@myhost # uname -a
SunOS myhost 5.10 Generic_125100-06 sun4v sparc SUNW,Sun-Fire-T200
root@myhost # pwd
/etc/init.d
root@myhost # more routeadd
#!/bin/sh
#
# Static routes to Maintenance and Backup network for eg. AppGate use
#
# To install:
# 1) cp routeadd /etc/init.d
# 2) perform edits on the script as required
# 3) chmod 744 /etc/init.d/routeadd
# 4) chown root:sys /etc/init.d/routeadd
# 5) ln /etc/init.d/routeadd /etc/rc2.d/S99routeadd
#
GATEWAY=10.188.131.1
BACKUP_GATEWAY=10.190.131.1
BACKUP_NET=10.190.128.0
case "$1" in
'start')
echo "adding static network route"
/usr/sbin/route add -net 147.243.2.0 ${GATEWAY} 1
/usr/sbin/route add -net 147.243.17.0 ${GATEWAY} 1
/usr/sbin/route add -net 147.243.130.0 ${GATEWAY} 1
/usr/sbin/route add -net 147.243.145.0 ${GATEWAY} 1
/usr/sbin/route add -net 147.243.226.0 ${GATEWAY} 1
/usr/sbin/route add -net 147.243.233.0 ${GATEWAY} 1
/usr/sbin/route add -net 147.243.194.0 ${GATEWAY} 1
/usr/sbin/route add -net 147.243.209.0 ${GATEWAY} 1
/usr/sbin/route add -net 10.40.15.0 ${GATEWAY} 1
/usr/sbin/route add -net 10.40.17.0 ${GATEWAY} 1
/usr/sbin/route add -net ${BACKUP_NET} ${BACKUP_GATEWAY} 1
;;
'stop')
echo "deleting static network route"
/usr/sbin/route delete -net 147.243.2.0 ${GATEWAY} 1
/usr/sbin/route delete -net 147.243.17.0 ${GATEWAY} 1
/usr/sbin/route delete -net 147.243.130.0 ${GATEWAY} 1
/usr/sbin/route delete -net 147.243.145.0 ${GATEWAY} 1
/usr/sbin/route delete -net 147.243.226.0 ${GATEWAY} 1
/usr/sbin/route delete -net 147.243.233.0 ${GATEWAY} 1
/usr/sbin/route delete -net 147.243.194.0 ${GATEWAY} 1
/usr/sbin/route delete -net 147.243.209.0 ${GATEWAY} 1
/usr/sbin/route delete -net 10.40.15.0 ${GATEWAY} 1
/usr/sbin/route delete -net 10.40.17.0 ${GATEWAY} 1
/usr/sbin/route delete -net ${BACKUP_NET} ${BACKUP_GATEWAY} 1
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit 0
root@myhost # ls /etc/rc*.d/*route*
/etc/rc2.d/S99routeadd
root@myhost # netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
-------------------- -------------------- ----- ----- ------ ---------
10.188.131.0 10.188.131.40 U 1 877 e1000g2
10.190.131.0 10.190.131.37 U 1 102 e1000g3
10.160.242.0 10.160.242.37 U 1 11382 e1000g0
10.160.242.0 10.160.242.37 U 1 0 e1000g0:1
10.160.242.0 10.160.242.37 U 1 1254 e1000g1
147.243.2.0 10.188.131.1 UG 1 0
147.243.130.0 10.188.131.1 UG 1 0
147.243.226.0 10.188.131.1 UG 1 0
147.243.194.0 10.188.131.1 UG 1 0
147.243.233.0 10.188.131.1 UG 1 0
10.40.15.0 10.188.131.1 UG 1 0
147.243.17.0 10.188.131.1 UG 1 2179
147.243.145.0 10.188.131.1 UG 1 91
147.243.209.0 10.188.131.1 UG 1 0
10.40.17.0 10.188.131.1 UG 1 0
10.190.128.0 10.190.131.1 UG 1 202
224.0.0.0 10.160.242.37 U 1 0 e1000g0
default 10.160.242.1 UG 1 50800
127.0.0.1 127.0.0.1 UH 33 447401 lo0
root@myhost #
Wednesday, June 18, 2008
Subscribe to:
Post Comments (Atom)
1 comment:
Solaris 10 (Sparc) provides the
option -p for command route
e.g.
route -p add ....
it adds an persistent entry in
/etc/inet/static_routes
Post a Comment