一个实例默认只有1个网络接口;

步骤一、创建一个新的网络接口,附加到实例。

步骤二、手动添加路由

增加两个路由表,为后续的双网关做点小准备:

vim /etc/iproute2/rt_tables

添加:

252 e0
251 e1

接下来手动添加静态路由规则,可以理解为,让哪里进来的,就从哪里出去,而本机出去的呢,走默认网关11.22.33.1…

# ip route flush table e0
# ip route add default via 11.22.33.1 dev eth0 src 11.22.33.44 table e0
# ip route add 127.0.0.0/8 dev lo table e0
# ip rule add from 11.22.33.44 table e0
 
# ip route flush table e1
# ip route add default via 22.33.44.1 dev eth1 src 22.33.44.55 table e1
# ip route add 127.0.0.0/8 dev lo table e1
# ip rule add from 22.33.44.55 table e1

  

相关文章:

  • 2021-12-14
  • 2021-10-16
  • 2021-06-05
  • 2022-12-23
  • 2021-11-08
  • 2022-01-09
  • 2021-10-16
  • 2022-12-23
猜你喜欢
  • 2021-10-26
  • 2022-02-04
  • 2022-12-23
  • 2021-10-04
  • 2021-11-01
  • 2021-08-24
  • 2022-12-23
相关资源
相似解决方案