summaryrefslogtreecommitdiff
path: root/net-physical
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-04-14 22:27:19 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-04-14 22:27:19 +0000
commitb1781a5da105b8566e49c686ae0fb23be18eab94 (patch)
tree006fcf1b1ca1c3d7e1b19ca596dca90a172c3185 /net-physical
parent04a8434a6186b5f52f23d5e6ebeff2aea83e94bf (diff)
downloadlive-b1781a5da105b8566e49c686ae0fb23be18eab94.tar.gz
Automatically configure network
Diffstat (limited to 'net-physical')
-rwxr-xr-xnet-physical20
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