TiVoCommunity.com
(c)opyright 1995-2005 All rights reserved
indexcheckTC
This area is a static history of posts in the TiVo Community Forum Archive.
This archive history was made for the simple indexing of search sites like Google.



Pages:1



dhclient-script file

(Click here to view the original thread with full colors/images)



Posted by: Kevin Clark

I screwed up my dhclient-script file. Does anyone have a file that I can use? I have a philips dsr6k running v3.1.



Posted by: Kevin Clark

Can someone look at this and tell me if there is an error, especially the ifs & fis and the beginning of the lines in particular the section in red:






#!/bin/sh
# dhclient-script for Linux. Dan Halbert, March, 1997.
# Updated for Linux 2.[12] by Brian J. Murrell, January 1999.
# No guarantees about this. I'm a novice at the details of Linux
# networking.
# Pruned down for TiVo use, September 2001. Enhanced to allow for
# use on 2.1.24 kernel, with pppd complexities, January 2002.
#

if [ x$new_broadcast_address != x ]; then
new_broadcast_arg="broadcast $new_broadcast_address"
fi
if [ x$old_broadcast_address != x ]; then
old_broadcast_arg="broadcast $old_broadcast_

fi
if [ x$new_subnet_mask != x ]; then
new_subnet_arg="netmask $new_subnet_mask"

if [ x$alias_subnet_mask != x ]; then
alias_subnet_arg="netmask $alias_subnet_mask"
fi

if [ x$reason = xMEDIUM ]; then
# Linux doesn't do mediums (ok, ok, media).
exit 0
fi

if [ x$reason = xPREINIT ]; then
if [ x$alias_ip_address != x ]; then
# Bring down alias interface. Its routes will disappear too.
ifconfig $interface:0- inet 0
fi
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
# We need to give the kernel some time to get the interface up.
sleep 1

# Add routes to make broadcast work. Do not omit netmask.
route add default dev $interface netmask 0.0.0.0
route add -host 255.255.255.255 dev $interface
route add -net 255.255.255.0 netmask 255.255.255.0 dev $interface

sleep 1

exit 0
fi

if [ x$reason = xARPCHECK ] || [ x$reason = xARPSEND ]; then
exit 0
fi

if [ x$reason = xBOUND ] || [ x$reason = xRENEW ] || \
[ x$reason = xREBIND ] || [ x$reason = xREBOOT ]; then
if [ x$old_ip_address != x ] && [ x$alias_ip_address != x ] && \
[ x$alias_ip_address != x$old_ip_address ]; then
# Possible new alias. Remove old alias.
ifconfig $interface:0- inet 0
fi
if [ x$old_ip_address != x ] && [ x$old_ip_address != x$new_ip_address ]; then
# IP address changed. Bringing down the interface will delete all routes,
# and clear the ARP cache.
ifconfig $interface inet down

fi
if [ x$old_ip_address = x ] || [ x$old_ip_address != x$new_ip_address ] || \
[ x$reason = xBOUND ] || [ x$reason = xREBOOT ]; then

ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg
# Add a network route to the computed network address.
route add -net $new_network_number $new_subnet_arg dev $interface
for router in $new_routers; do
route add default gw $router
done
fi
if [ x$reason = xREBIND ] && [ x$old_ip_address = x$new_ip_address ] && \
! grep -q ppp0: /proc/net/dev || ! ( route -n | grep -q ^0.0.0.0 ) ; then
# We're renewing, same IP address, there's no default route, and PPP isn't
# up. pppd probably removed our previous default route. Put it back.
# I'd rather do this via route metrics but they aren't sufficiently well
# supported in 2.1.24
for router in $new_routers; do
route add default gw $router
done
fi
if [ x$new_ip_address != x$alias_ip_address ] && [ x$alias_ip_address != x ];
then
ifconfig $interface:0- inet 0
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address $interface:0
fi
exit 0
fi

if [ x$reason = xEXPIRE ] || [ x$reason = xFAIL ]; then
if [ x$alias_ip_address != x ]; then
# Turn off alias interface.
ifconfig $interface:0- inet 0
fi
if [ x$old_ip_address != x ]; then
# Shut down interface, which will delete routes and clear arp cache.
ifconfig $interface inet down
# Bring the interface back up and make it suitable for broadcasting
# requests again, as if we were in PREINIT phase.
sleep 1
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
sleep 1
route add default dev $interface netmask 0.0.0.0
route add -host 255.255.255.255 dev $interface
route add -net 255.255.255.0 netmask 255.255.255.0 dev $interface
sleep 1
fi
if [ x$alias_ip_address != x ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address $interface:0
fi
exit 0
fi

if [ x$reason = xTIMEOUT ]; then
if [ x$alias_ip_address != x ]; then
ifconfig $interface:0- inet 0
fi
ifconfig $interface inet $new_ip_address $new_subnet_arg \
$new_broadcast_arg
set $new_routers
############## what is -w in ping?
if ping -q -c 1 $1; then
if [ x$new_ip_address != x$alias_ip_address ] && \
[ x$alias_ip_address != x ]; then
ifconfig $interface:0 inet $alias_ip_address $alias_subnet_arg
route add -host $alias_ip_address dev $interface:0
fi
route add -net $new_network_number
for router in $new_routers; do
route add default gw $router
done
exit 0
fi
ifconfig $interface inet down
# Bring the interface back up and make it suitable for broadcasting
# requests again, as if we were in PREINIT phase.
sleep 1
ifconfig $interface inet 0.0.0.0 netmask 0.0.0.0 \
broadcast 255.255.255.255 up
sleep 1
route add d
route add -host 255.255.255.255 dev $interface route add -net 255.255.255.0 netmask 255.255.255.0 dev $interface
sleep 1
exit 1
fi
"interface "eth0" { send host-name "Bedroom"; }
exit 0





vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Limited.
vB Easy Archive Final ©2000 - 2009 - Created by Stefan "Xenon" Kaeser Modified by Adam J. de Jaray