summaryrefslogtreecommitdiff
path: root/net-physical
blob: 50dedf5089714ae059fcee752282f427a5abfc18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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