前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >ubuntu 14.04配置3线3IP

ubuntu 14.04配置3线3IP

作者头像
py3study
发布2020-01-08 16:52:48
6730
发布2020-01-08 16:52:48
举报
文章被收录于专栏:python3python3

1、3线3IP服务器接口IP地址(vlan接口)

em1.12  单联通:120.52.139.9    掩码:255.255.255.240  网关:120.52.139.1

em1.13  单电信:123.58.236.26   掩码:255.255.255.248  网关:123.58.236.25

em1.16  单移动:223.71.150.91   掩码: 255.255.255.248  网关:223.71.150.89 

2、配置路由表标签

test@ubuntu:~$  cat /etc/iproute2/rt_tables

#

# reserved values

#

255 local

254 main

253 default

0 unspec

#(增加下面联通、电信、移动路由标签)

252 cnc

251 ct

250 yd

3、配置路由表及路由策略

sudo ip route add table cnc  via 120.52.139.1 dev em1.12 src  120.52.139.9

sudo ip rule add from  120.52.139.9 table cnc 

sudo ip route add table ct  via 123.58.236.25 dev em1.13 src  123.58.236.26

sudo ip rule add from  123.58.236.26 table ct

sudo ip route add table yd  via 223.71.150.89 dev em1.16 src  223.71.150.91

sudo ip rule add from  223.71.150.91 table yd 

4、把路由表及路由策略写到开机自启动

test@ubuntu:~$ sudo cat /etc/rc.local 

#!/bin/sh -e

#

# rc.local

#

# This script is executed at the end of each multiuser runlevel.

# Make sure that the script will "exit 0" on success or any other

# value on error.

#

# In order to enable or disable this script just change the execution

# bits.

#

# By default this script does nothing.

sudo ip route add table cnc  via 120.52.139.1 dev em1.12 src  120.52.139.9

sudo ip rule add from  120.52.139.9 table cnc 

sudo ip route add table ct  via 123.58.236.25 dev em1.13 src  123.58.236.26

sudo ip rule add from  123.58.236.26 table ct

sudo ip route add table yd  via 223.71.150.89 dev em1.16 src  223.71.150.91

sudo ip rule add from  223.71.150.91 table yd 

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-08-31 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档