常州五颜六色网络技术有限公司 -> 技术文档 -> redhat centos系统的双线路由的设置 登录 -> 注册 -> 回复主题 -> 发表主题

阿七 2008-04-29 10:51

以intel 3000AH 单网卡绑定双IP为例

ifcfg-eth0的设置不变 内容如下:

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)
DEVICE=eth0
BOOTPROTO=static
BROADCAST=61.160.210.63
HWADDR=00:15:17:38:CD:99
IPADDR=61.160.210.27
IPV6ADDR=
IPV6PREFIX=
NETMASK=255.255.255.192
NETWORK=61.160.210.0
ONBOOT=yes



新建一个ifcfg-eth0:0

nano /etc/sysconfig/network-scripts/ifcfg-eth0:0

内容如下:

DEVICE=eth0:0
IPADDR=221.6.140.30
NETMASK=255.255.255.224
ONBOOT=yes

保存退出

然后执行 yum install iproute2

iproute2安装完成后,在任意目录下新建一个S30route

如:nano /etc/rc.d/rc2.d/S30route

填入S30route的内容

保存退出

同一目录下 chmod 777 S30route

接下来编辑rc.local

nano /etc/rc.local

加上: sh /etc/rc.d/rc2.d/S30route
保存退出

--------------

reboot后 会自动加载S30route

由于脚本加载的先后顺序的不同 eth0:0上设置的IP生效要比eth0慢三十几秒。

阿七 2008-04-29 11:26
题外链接:

在debian上使用rc.local

习惯了RedHat上使用/etc/rc.local 定制服务的自动启动,最近用Debian还真有些不习惯。以下是我搜集到的资料:在debian上创建rc.local文件。

创建文件:
touch /etc/init.d/rc.local
设置可执行:
chmod +x /etc/init.d/rc.local
用update-rc.d设置启动级别:
update-rc.d rc.local start 20 2 3 4 5 . stop 20 0 1 6 .

为了编辑方便,创建一个链接:
ln -s /etc/init.d/rc.local /etc/rc.local

cat /etc/rc.local
# start apache
/home/apache/bin/apachectl start

重启一下,没有问题。

后记:Debian 下没有 rc.local ,不过有一个替代品,就是 /etc/init.d/bootmisc.sh 文件(可以将/etc/rc.local 链接过去)
大家有什么需要启动后运行的,尽管往里面塞 :-P

类似的:也是使用update-rc.d 将相应服务设置成启动就可以了。


查看完整版本: [-- redhat centos系统的双线路由的设置 --] [-- top --]




Copyright © 2005-2006 5y6s Inc. 苏ICP备05001866号 Powered by PHPWind 5.0.1
Time 0.016161 second(s),query:4 Gzip enabled
☏:0519-6605212 QQ:271689/8732391/5631218/5285234