I must be having a rough week or just getting older but I can’t seem to come up with an elegant solution to this problem… Ok… I have WSL on my workstation, when I establish VPN to $work, WSL buggers resolv.conf.
From: nameserver <mine> search <$homedomain>
To: nameserver <mine> nameserver <$work1> nameserver <$work2> search <$workdomain>
I have to manually take line 1 and move it to line 3 for internal resolution to work… EVERY DAMNED TIME WSL instantiates (while VPN is established). This is because $workdomain is blackholed publicly.
My first thought was a stupid ed script to move line 1 to 3… that didn’t work so well (my ed skills are apparently lacking).
Ideally the solution would note if there 3 or more nameserver lines, move the lines before ‘nameserver <$work1>’ to one line before the last file. I’d pop that into my .bashrc/.profile or similar.
I couldn’t find how WSL manipulates the file itself otherwise I would have tried to change it…
Anyone have any ideas there?
-- Sean