linux 双线策略路由!!
网络环境
服务器(网关):
eth0 为LAN口,IP为 LAN_IP = 192.168.0.1
eth1 为第一个WAN口,接电信线路,IP为 CTC_IP,网关为 CTC_GW
eth2 为第二个WAN口,接网通线路,IP为 CNC_IP,网关为 CNC_GW
策略路由方式
为了方便,我们增加2个策略路由表,电信 => 100,网通 => 200,这样再添加规则时,就可以直接用自定义的名称来替代数字
echo "100 ctc" >> /etc/iproute2/rt_tables
echo "200 cnc" >> /etc/iproute2/rt_tables
1)设置默认路由(电信)
ip route replace default via 电信网关 dev eth1
2)对网通进行基于目的地址的策略路由
ip rule add to 网通路由表1 table cnc prio 100
ip rule add to 网通路由表2 table cnc prio 100
....
3)添加原路返回路由
ip route flush table ctc
ip route add default via 电信网关 dev eth1 src 电信IP table ctc
ip route add 192.168.0.0/24 dev eth0 scope link src 192.168.0.1 table ctc
ip rule add from 电信IP table ctc
ip route flush table cnc
ip route add default via 网通网关 dev eth2 src 网通IP table cnc
ip route add 192.168.0.0/24 dev eth0 scope link src 192.168.0.1 table ctc
ip rule add from 网通IP table cnc
请问:
ip route a
相关问答:
写了个测试程序如下
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
......
各位老师好:小弟有一点问题 琢磨了好久想请教大师们:
我在安装mysql的时候 安装到
./configure \
--prefix=/usr/local/mysql \
--with-extra-charsets=all
这步的时候出现:
configure: unknown option --p ......
我下载的linux2.6.29中的wifi只支持wep方式加密. 怎么样让他能支持wpa或wpa II方式加密?
并且还有个奇怪的问题就是linux2.6.29中的wep密码要是5/13字节长的.其他的长度不支持.
mac80211\wext.c中有如下代码
stati ......
大家好:
我的电脑练的是教育网,上不了外国的网站,在用Linux更新软件,例如apt-get或是yum的时候连不到服务器。不知道大家有没有过这种情况啊,是如何解决的啊,谢了!
可以找一下,edu的更新源。比如 ......
linux虚拟机 安装oracle11g出现
/bin/cat: /proc/sys/fs/aio-max-nr: No such file or directory
/bin/cat: /proc/sys/fs/aio-max-nr: No such file or directory
/bin/cat: /proc/sys/fs/aio-max-nr: No such fi ......