Guest User

Untitled

a guest
May 19th, 2018
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. #!/bin/bash
  2. # Add or list DNS entries in an 02 wireless box
  3. # To compensate for O2's unreliable DNS provision
  4.  
  5. # h/u/p for standard O2 wireless box
  6. host=192.168.1.254
  7. user=SuperUser
  8. pass=O2Br0ad64nd
  9.  
  10. # OpenDNS server to add
  11. # Can be overridden on command prompt
  12. dns=4.2.2.2
  13. metric=5
  14.  
  15. # First argument either:
  16. if [ "$1" != "" ]; then
  17. # -h to list usage
  18. if [ "$1" == "-h" ]; then
  19. echo "Usage: $0 [x.x.x.x|list] [weight]"
  20. exit
  21. fi
  22. # DNS entry
  23. dns="$1"
  24. # Or "list" command: see below
  25. fi
  26.  
  27. # Second argument is the metric for the DNS entry
  28. if [ "$2" != "" ]; then
  29. metric="$2"
  30. fi
  31.  
  32. # Standard command to send over telnet
  33. cmd="dns server route add dns=$dns intf=O2_ADSL2plus metric=$metric"
  34. # Replace with completely different command if we want to list all routes
  35. if [ "$1" == "list" ]; then
  36. cmd="dns server route list"
  37. fi
  38.  
  39. # Pipe session into telnet command
  40. ( echo open $host
  41. echo ^]set echo ^
  42. sleep 1
  43. echo -e "${user}\r"
  44. sleep 1
  45. echo -e "${pass}\r"
  46. sleep 1
  47. echo -e "$cmd\r"
  48. sleep 1
  49. echo -e "quit\r" ) | telnet
Add Comment
Please, Sign In to add comment