Chinaunix首页 | 论坛 | 博客
  • 博客访问: 82726
  • 博文数量: 42
  • 博客积分: 185
  • 博客等级: 入伍新兵
  • 技术积分: 250
  • 用 户 组: 普通用户
  • 注册时间: 2010-03-25 21:43
文章分类

全部博文(42)

文章存档

2012年(38)

2010年(4)

我的朋友

分类:

2012-03-07 19:37:18

原文地址:ifdown-ipv6 作者:syxian

  1. #!/bin/sh
  2. #
  3. # filename: ifdown-ipv6
  4. #
  5. # RedHat 6.2
  6. # directory: /etc/sysconfig/network-scripts
  7. #
  8. # permissions: 755
  9. #
  10. # description: Brings down IPv6 for an interface
  11. #
  12. # (P) & (C) 2000 by Peter Bieringer <pb@bieringer.de>
  13. #
  14. # This script is now explicitly GPL'ed (20001125, Peter Bieringer)
  15. #
  16. #
  17. # Suggestions, comments and improvements are welcome!
  18. #
  19. # You will find more information in the IPv6-HowTo for Linux at
  20. #
  21. #
  22. # Changes to:
  23. # 20000703: initial for a new layout
  24. # 20000704: add test for static route file
  25. # 20000723: fix bug in static route selection
  26. # 20000731: fix misnamed function 'forwarding-ipv6-route' -> 'forwarding-ipv6'
  27. # 20000816: fix because "network-functions-ipv6" function names are changed
  28. # 20001125: explicitly GPL'ed
  29. # 20001130: remove not needed copyright reference to RedHat

  30. #set -x

  31. . /etc/sysconfig/network

  32. cd /etc/sysconfig/network-scripts
  33. . network-functions

  34. CONFIG=$1
  35. [ -f "$CONFIG" ] || CONFIG=ifcfg-$CONFIG
  36. source_config

  37. # Test if IPv6 configuration is enabled
  38. if [ ! "$IPV6INIT" = "yes" ]; then
  39.         # not enabled, stop here
  40.         exit 0
  41. fi
  42.   
  43. # Test if IPv6 is up
  44. if [ "${NETWORKING_IPV6}" = "yes" ]; then
  45.         if [ ! -f /etc/sysconfig/network-scripts/network-functions-ipv6 ]; then
  46.                 echo -e "\a You have enabled IPv6 in '/etc/sysconfig/network'"
  47.                 echo " by setting 'NETWORKING_IPV6' to 'yes', but"
  48.                 echo " file '/etc/sysconfig/network-scripts/network-functions-ipv6"
  49.                 echo " is missing -> disabling it!"
  50.                 NETWORKING_IPV6=no
  51.         else
  52.                 . /etc/sysconfig/network-scripts/network-functions-ipv6

  53.         # Delete additional static IPv6 routes on specified interface
  54.                 if [ -f /etc/sysconfig/static-routes-ipv6 ]; then
  55.             grep "^$DEVICE" /etc/sysconfig/static-routes-ipv6 | while read device args; do
  56.          if [ "$device" = "$DEVICE" ]; then
  57.                             ifdown_ipv6_route $args $DEVICE
  58.                 fi
  59.             done
  60.         fi

  61.         # Switch off forwarding per device (packets received on this
  62.         # interface aren

阅读(333) | 评论(0) | 转发(0) |
0

上一篇:高级Bash脚本编程指南

下一篇:linux关闭IPV6

给主人留下些什么吧!~~