- 追加された行はこの色です。
- 削除された行はこの色です。
*Linuxのルーティング [#l298c517]
基本
*xpwiki [#wb9e21fd]
[[xpwiki>+http://xoops.hypweb.net/modules/xpwiki/]]
~
*routeの恒久的な追加 [#m9bd8151]
基本的には以下ファイルのパターンを使用して追加する
どのファイルも特殊な書式なので注意する事
# vi /etc/sysconfig/static-routes
# vi /etc/sysconfig/network-scripts/route-eth0
# vi /etc/sysconfig/network-scripts/route-br0
*xpwiki別窓リンク [#sd2a65bb]
ファイルの編集箇所は[[PukiWikiでの別窓リンク方法>PukiWiki/改良/別窓リンク]]と似ているのだが、編集箇所の一部が違うのでメモ
使い方はPukiWikiでの場合と同じでURLの先頭に”+”を付加する
# cd [XOOPS_TRUST_PATH]/modules/xpwiki/class
# cp make_link.php make_link.php-
# chown root.root make_link.php-
# chmod 400 make_link.php-
# vi make_link.php
~
*routeの恒久的な削除 [#a237c417]
[[追加の方法>#o9df9a5e]]はあるのに、削除の方法は調べた限りでは無かったのでスクリプトを改造する
使える場面としては2枚のNICを挿した鯖で、それらのNICに同一セグメントのIPアドレスを割り振る時には使えると思われる
なお、&font(b){Linuxのパッケージアップデート『yum update』をした際に該当スクリプトが初期化されるらしいので、その時は再度書き換えるか、後述する専用スクリプトを使用する};
以後の書き換える場所は、バージョン毎によって変化
[[ver 4.x>#vc76c24f]]
[[ver 5.x>#g5d8add3]]
~
-&size(16){&font(b){1. スクリプト修正};};
ネットワークをリスタートした際にも正常に動作する様にスクリプトを修正
# vi /etc/init.d/network
_/_/_/_/_/
-# Add non interface-specific static-routes.
-if [ -f /etc/sysconfig/static-routes ]; then
- grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
- /sbin/route add -$args
- done
-fi
_/_/_/_/_/
+# Add and Del interface-specific static-routes.
+if [ -f /etc/sysconfig/static-routes ]; then
+ grep "^any" /etc/sysconfig/static-routes | while read ignore args ; do
+ /sbin/route add -$args
+ done
+ grep "^del" /etc/sysconfig/static-routes | while read ignore args ; do
+ /sbin/route del -$args
+ done
+fi
*xpwiki別窓リンク - ver 4.x [#vc76c24f]
-&size(16){&font(b){クラス名:XpWikiLink_url extends XpWikiLink};};
-メソッド名:function get_pattern()
-( # (3) url
- (?:(?:https?|ftp|news):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+
-)
_/_/_/_/_/
+( # (3) url
+ (?:(?:\+?https?|\+?ftp|\+?news):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+
+)
~
-&size(16){&font(b){2. 削除するスタティックルートのデータ};};
スタティックルートを追加する時に使用するファイルと兼用しているので、接頭語を追加して判別する
# vi /etc/sysconfig/static-routes
_/_/_/_/_/
※192.168.1.0/24でインターフェースがbr0のルーティングを削除する時
del net 192.168.1.0 netmask 255.255.255.0 br0
※link-locak(169.254.0.0)でインターフェースがbr0のルーティングを削除する時
del net link-local netmask 255.255.0.0 br0
-メソッド名:function toString()
- $img = ($this->is_image)? ' type="img"' : '';
- return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>';
_/_/_/_/_/
+ $img = ($this->is_image)? ' type="img"' : '';
+ if (ereg("^(\+)(.*)", $this->name, $regs)) {
+ return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>';
+ }else{
+ return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>';
+ }
----
-&size(16){&font(b){クラス名:XpWikiLink_url_i18n extends XpWikiLink};};
-メソッド名:function get_pattern()
-( # (3) scheme
- (?:(?:https?|ftp|news):\/\/|mailto:)
-)
_/_/_/_/_/
+( # (3) scheme
+ (?:(?:\+?https?|\+?ftp|\+?news):\/\/|mailto:)
+)
~
-&size(16){&font(b){3. 削除専用スクリプトの作成};};
/etc/init.d/networkが書き換えられた場合の応急処置スクリプトを作成
# vi ~/static-routes_del.sh
_/_/_/_/_/
#!/bin/bash
PATH=/bin:/sbin:/usr/bin
# Delete interface-specific static-routes.
if [ -f /etc/sysconfig/static-routes ]; then
grep "^del" /etc/sysconfig/static-routes | while read ignore args ; do
/sbin/route del -$args
done
fi
_/_/_/_/_/
# chmod 700 ~/static-routes_del.sh
# chown root.root ~/static-routes_del.sh
-メソッド名:function toString()
- return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>'.$host;
_/_/_/_/_/
+ if (ereg("^(\+)(.*)", $this->name, $regs)) {
+ return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host;
+ }else{
+ return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host;
+ }
~
*xpwiki別窓リンク - ver 5.x [#g5d8add3]
-&size(16){&font(b){クラス名:XpWikiLink_url extends XpWikiLink};};
-メソッド名:function get_pattern()
-( # (3) url
- (?:(?:https?|ftp|news|site):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+
-)
_/_/_/_/_/
+( # (3) url
+ (?:(?:\+?https?|\+?ftp|\+?news|\+?site):\/\/|mailto:)[\w\/\@\$()!?&%#:;.,~'=*+-]+
+)
~
-メソッド名:function toString()
- $img = ($this->is_image)? ' type="img"' : '';
- return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>';
_/_/_/_/_/
+ $img = ($this->is_image)? ' type="img"' : '';
+ if (ereg("^(\+)(.*)", $this->name, $regs)) {
+ return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>';
+ }else{
+ return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>';
+ }
----
-&size(16){&font(b){クラス名:XpWikiLink_url_i18n extends XpWikiLink};};
-メソッド名:function get_pattern()
-( # (3) scheme
- (?:(?:https?|ftp|news|site):\/\/|mailto:)
-)
_/_/_/_/_/
+( # (3) scheme
+ (?:(?:\+?https?|\+?ftp|\+?news|\+?site):\/\/|mailto:)
+)
~
-メソッド名:function toString()
- return '<a href="'.$this->name.'"'.$title.$rel.$class.$img.$target.'>'.$this->alias.'</a>'.$host;
_/_/_/_/_/
+ if (ereg("^(\+)(.*)", $this->name, $regs)) {
+ return '<a href="' . $regs[2] . '" target="_blank" ' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host;
+ }else{
+ return '<a href="' . $this->name . '"' . $title.$rel.$class.$img.$target . '>' . $this->alias . '</a>' . $host;
+ }
~