Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 89cfd9be3a
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 31 lines (27 sloc) 0.706 kb
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
#!/usr/bin/env ruby

DNS_SERVERS = {
  :google => %w[ 8.8.8.8 8.8.4.4 ],
  :level3 => %w[ 4.2.2.1 4.2.2.2 4.2.2.3 4.2.2.4 4.2.2.5 4.2.2.6 ],
  :opendns => %w[ 208.67.222.222 208.67.220.220 ],
  :linenode => %w[ 109.74.193.20 109.74.194.20 109.74.192.20 ],
  :gwi => %w[ 207.5.171.1 207.5.171.9 ],
}

if ARGV.length < 1
  puts "Set a nameserver from a list"
  puts
  puts "list - to get a list of choices"
  puts "name - to set nameserver from list"
  exit 0
end

if ARGV.to_s =~ /list/
  DNS_SERVERS.each do |key,value|
    puts key
  end
else
  File.open('/etc/resolv.conf', 'w+') do |file|
    DNS_SERVERS[ARGV[0].to_sym].each do |ip|
      file.puts "nameserver #{ip}"
    end
    #file.flush
  end
end
Something went wrong with that request. Please try again.