码迷,mamicode.com
首页 > 其他好文 > 详细

多线多IP的服务器配置

时间:2017-01-06 17:33:53      阅读:393      评论:0      收藏:0      [点我收藏+]

标签:多线多ip配置



1、服务器IP地址配置

   

eth0: 120.52.139.30/29     网关  120.52.139.25       联通地址

eth1: 123.58.236.11/28  网关   123.58.236.1           电信地址

eth2 : 112.35.19.38/29   网关   112.35.19.33           移动地址


2、配置路由表标签

[root@ttonnet ~]# cat /etc/iproute2/rt_tables

#

# reserved values

#

255 local

254 main

253 default

252 cnc

251 ct

250 yd

0 unspec

#

# local

#

#1 inr.ruhep


3、执行下面的命令

ip route add default via 120.52.139.25 dev eth0 src 120.52.139.30 table cnc

ip rule add from 120.52.139.30 table cnc


ip route add default via 123.58.236.1 dev eth1 src 123.58.236.11 table ct

ip rule add from 123.58.236.11 table ct


ip route add default via 112.35.19.33 dev eth2 src 112.35.19.38 table yd

ip rule add from 112.35.19.38 table yd


4、把上面的命令放到开机自启动脚本

[root@ttonnet ~]# cat /etc/rc.local

#!/bin/sh

#

# This script will be executed *after* all the other init scripts.

# You can put your own initialization stuff in here if you don‘t

# want to do the full Sys V style init stuff.


ip route add default via 120.52.139.25 dev eth0 src 120.52.139.30 table cnc

ip rule add from 120.52.139.30 table cnc


ip route add default via 123.58.236.1 dev eth1 src 123.58.236.11 table tel

ip rule add from 123.58.236.11 table tel


ip route add default via 112.35.19.33 dev eth2 src 112.35.19.38 table yd

ip rule add from 112.35.19.38 table yd



[root@ttonnet ~]#



本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1889651

多线多IP的服务器配置

标签:多线多ip配置

原文地址:http://zhanguo1110.blog.51cto.com/5750817/1889651

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!