Monday Jun 01, 2009

Network Auto Magic and Profiles

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
#!/bin/sh
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
#!/bin/sh
echo "nameserver 1.2.3.4\\nnameserver 1.2.3.5" > /etc/resolv.conf

Note: These interfaces can change in future as it's stated in above mentioned man page.

About

psum

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today