1、在腾讯云控制台进行弹性网卡的绑定:
2、登录到服务器上进行网卡配置:vim /etc/network/interfaces.d/50-cloud-init.cfg
auto eth0:0 iface eth0:0 inet static address 10.0.64.13 netmask 255.255.255.0 gateway 10.0.64.1
auto eth0:1 iface eth0:1 inet static address 10.0.64.16 netmask 255.255.255.0 gateway 10.0.64.1
auto eth1:0 iface eth1:0 inet static address 10.0.64.8 netmask 255.255.255.0 gateway 10.0.64.1
auto eth1:1 iface eth1:1 inet static address 10.0.64.2 netmask 255.255.255.0 gateway 10.0.64.1
3、创建路由表:vim /etc/iproute2/rt_tables,在后面追加:
10 t1
20 t2
30 t3
40 t4
4、给4张路由表添加默认路由:
ip rule add from 10.0.64.13/32 table 10
ip rule add from 10.0.64.16/32 table 20
ip rule add from 10.0.64.8/32 table 30
ip rule add from 10.0.64.2/32 table 40
5、为防止重启后失效,将路由和策略都加入到rc.local文件,vim /etc/rc.local
6、测试
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。