By psum on Jun 01, 2009
One of the wifi networks I connect to with my OpenSolaris 2009.06 laptop provides wrong list of DNS servers. In order to get properly working Internet I need after connecting change content of /etc/resolv.conf. But you don't want to do such thing manually every time you connect.
At this situation I learned in nwadm(1) info about Profiles which perfectly solved my problem.
First I had to prepare script which will determine whether I have just connected to my problematic wifi (used BSSID is just an example):
$ cat /etc/nwam/ulp/check-conditions
dladm show-wifi -o BSSID | grep 0:1:2:3:4:5 > /dev/null && echo bad-dns-wifi
Then I had to create "bringup" script for new "bad-dns-wifi" profile which will modify resolv.conf file. Again, IPs are just an exmple:
$ cat /etc/nwam/ulp/bad-dns-wifi/bringup
echo "nameserver 220.127.116.11\\nnameserver 18.104.22.168" > /etc/resolv.conf
Note: These interfaces can change in future as it's stated in above mentioned man page.