编辑:为了澄清我不是指iptables而是ip工具(我认为很多人都不熟悉).在任何情况下,我试图保持的规则添加以下命令:
# ip rule add fwmark 1 lookup 100# ip rule...32765: from all fwmark 0x1 lookup 100...
我发现这样做的唯一参考来自Novell:http://www.novell.com/support/viewContent.do?externalId=7008874&sliceId=1,它建议创建一个rc.d脚本
解决方法 按照惯例,我在询问后不久就偶然发现了自己问题的答案:)在 http://grokbase.com/t/centos/centos/099bmc07mq/persisting-iproute2-routes-and-rules找到答案在Redhat 5上,/ etc / sysconfig / network-scripts / ifup-routes脚本处理rule- *文件.相关代码如下:
# Routing rulesfileS="/etc/sysconfig/network-scripts/rule-"if [ -n "" -a "" != "" ]; then fileS="$fileS /etc/sysconfig/network-scripts/rule-"fifor file in $fileS; do if [ -f "$file" ]; then { cat "$file" ; echo ; } | while read line; do if [[ ! "$line" =~ $MATCH ]]; then /sbin/ip rule add $line fi done fidone
RHEL 6.5的脚本(可能是较旧的6):
# Routing rulesfileS="/etc/sysconfig/network-scripts/rule- /etc/sysconfig/network-scripts/rule6-"if [ -n "" -a "" != "" ]; thenfileS="$fileS /etc/sysconfig/network-scripts/rule- /etc/sysconfig/network-scripts/rule6-"fifor file in $fileS; do if [ -f "$file" ]; then handle_ip_file $file fidonehandle_ip_file() { local f t type= file= proto="-4" f=${file##*/} t=${f%%-*} type=${t%%6} if [ "$type" != "$t" ]; then proto="-6" fi { cat "$file" ; echo ; } | while read line; do if [[ ! "$line" =~ $MATCH ]]; then /sbin/ip $proto $type add $line fi done}总结
以上是内存溢出为你收集整理的Linux上的持久性ip规则(Redhat)全部内容,希望文章能够帮你解决Linux上的持久性ip规则(Redhat)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)