blob: 6a4fa355d9668c382891a7a510d8379079965133 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
#!/bin/sh
links=`dladm show-phys -o link 2>/dev/null| grep -v LINK`
for link in $links; do
echo "Plumbing $link ... " >/dev/msglog
if ipadm "create-if" $link 2>/dev/null; then # create-if is in quotes because ViM goes crazy
echo "Plumbed $link!" >/dev/msglog
echo "Trying DHCP for $link ... " >/dev/msglog
if ipadm create-addr -T dhcp -w 7 $link/dhcp 2>/dev/null; then
echo "Successfully configured $link via DHCP!" >/dev/msglog
exit 0
else
echo "DHCP for $link FAILED " >/dev/msglog
fi
else
echo "Plumbing $link FAILED " >/dev/msglog
fi
done
echo 'No network interfaces are configured via DHCP' >/dev/msglog
|