localnet 978 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/sh
  2. ########################################################################
  3. # Begin $rc_base/init.d/localnet
  4. #
  5. # Description : Loopback device
  6. #
  7. # Authors : Gerard Beekmans - gerard@linuxfromscratch.org
  8. #
  9. # Version : 00.00
  10. #
  11. # Notes :
  12. #
  13. ########################################################################
  14. . /etc/sysconfig/rc
  15. . ${rc_functions}
  16. . /etc/sysconfig/network
  17. case "${1}" in
  18. start)
  19. boot_mesg "Bringing up the loopback interface..."
  20. ip addr add 127.0.0.1/8 label lo dev lo
  21. ip link set lo up
  22. evaluate_retval
  23. boot_mesg "Setting hostname to ${HOSTNAME}..."
  24. hostname ${HOSTNAME}
  25. evaluate_retval
  26. ;;
  27. stop)
  28. boot_mesg "Bringing down the loopback interface..."
  29. ip link set lo down
  30. evaluate_retval
  31. ;;
  32. restart)
  33. ${0} stop
  34. sleep 1
  35. ${0} start
  36. ;;
  37. status)
  38. echo "Hostname is: $(hostname)"
  39. ip link show lo
  40. ;;
  41. *)
  42. echo "Usage: ${0} {start|stop|restart|status}"
  43. exit 1
  44. ;;
  45. esac
  46. # End $rc_base/init.d/localnet