diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-04-14 22:27:19 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-04-14 22:27:19 +0000 |
commit | b1781a5da105b8566e49c686ae0fb23be18eab94 (patch) | |
tree | 006fcf1b1ca1c3d7e1b19ca596dca90a172c3185 /net-physical | |
parent | 04a8434a6186b5f52f23d5e6ebeff2aea83e94bf (diff) | |
download | live-b1781a5da105b8566e49c686ae0fb23be18eab94.tar.gz |
Automatically configure network
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 |