diff options
Diffstat (limited to 'net-physical')
-rwxr-xr-x | net-physical | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/net-physical b/net-physical new file mode 100755 index 0000000..50dedf5 --- /dev/null +++ b/net-physical @@ -0,0 +1,20 @@ +#!/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 + printf "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 + break + else + echo "DHCP for $link FAILED " >/dev/msglog + fi + else + echo "Plumbing $link FAILED " >/dev/msglog + fi +done |