Hi James

Seems doesn't work... May be I should register in some way this hook? I 
think this file is not executed after reboot

d-espb04-125-177> ping ya.ru
ping: unknown host ya.ru
d-espb04-125-177> cat /etc/resolv.conf
domain russia.sun.com
nameserver 129.159.123.150
d-espb04-125-177> cat /etc/dhcp/eventhook
#!/bin/sh

if [ "$2" = BOUND -o "$2" = EXTEND ]; then
cat >/etc/resolv.conf <<EOF
domain moscow.russia.sun.com
nameserver 129.147.2.21
EOF
fi
d-espb04-125-177> ls -la /etc/dhcp/eventhook
-rwxr-xr-x   1 root     root         143 Aug 28 19:52 /etc/dhcp/eventhook
d-espb04-125-177> /etc/dhcp/eventhook test BOUND
/etc/dhcp/eventhook: /etc/resolv.conf: cannot create
d-espb04-125-177> su -
Password:
Sun Microsystems Inc.   SunOS 5.11      snv_70  October 2007
# /etc/dhcp/eventhook test BOUND
# cat /etc/resolv.conf
domain moscow.russia.sun.com
nameserver 129.147.2.21
# ping ya.ru
ya.ru is alive


James Carlson wrote:
> Oleg Vazhnev writes:
>   
>> Thank you for such fast report.
>> I have removed both ",6" and ",15" from /etc/default/dhcpagent and this 
>> is doesn't solve the problem.
>>     
>
> Not too surprising.
>
>   
>> So i really need to write some kind of script which will hack my 
>> resolv.conf?
>> If so, can you guide me?
>>     
>
> Sure; here's a possible example:
>
> #!/bin/sh
>
> if [ "$2" = BOUND -o "$2" = EXTEND ]; then
>       cat >/etc/resolv.conf <<EOF
> domain yourdomain.com
> nameserver 10.0.0.1
> EOF
> fi
>
> Just put that in a file called /etc/dhcp/eventhook (and owned by
> root), and make it executable ("chmod 755 /etc/dhcp/eventhook").
>
>   

_______________________________________________
networking-discuss mailing list
[email protected]

Reply via email to