Nonsense don't say more, directly look at the configuration, I believe a bit of Linux based on all understand.
Unicom Network card:
[Email protected] ~]# CAT/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENS4
Type=ethernet
Bootproto=static
Defroute=yes
Peerdns=yes
Peerroutes=yes
Ipv4_failure_fatal=no
Ipv6init=yes
Ipv6_autoconf=yes
Ipv6_defroute=yes
Ipv6_peerdns=yes
Ipv6_peerroutes=yes
Ipv6_failure_fatal=no
Name=ens4
Device=ens4
Onboot=yes
ipaddr=x.x.x.x # # #联通IP地址
netmask=x.x.x.x # # #联通掩码
gateway=x.x.x.x # # #联通网关
Telecom Network card:
[Email protected] ~]# CAT/ETC/SYSCONFIG/NETWORK-SCRIPTS/IFCFG-ENS5
Type=ethernet
Bootproto=static
Defroute=yes
Peerdns=yes
Peerroutes=yes
Ipv4_failure_fatal=no
Ipv6init=yes
Ipv6_autoconf=yes
Ipv6_defroute=yes
Ipv6_peerdns=yes
Ipv6_peerroutes=yes
Ipv6_failure_fatal=no
Name=ens5
Device=ens5
Onboot=yes
ipaddr=x.x.x.x # #电信ip
netmask=x.x.x.x # # #电信掩码
dns1=114.114.114.114
# # #注意不要配置网关, configured to not be able to surf the internet
Add in/etc/iproute2/rt_tables:
252 Tel
251 CNC
Below my:/etc/iproute2/rt_tables
#
# Reserved values
#
255Local
254Main
253Default
252 Tel
251 CNC
0Unspec
#
# Local
#
#1Inr.ruhep
Execute script:
IP route replace default via Telecom Gateway Dev ENS5
IP Route Flush Table Tel
IP route add default via telecom Gateway Dev ens5 src Telco IP Table Tel
IP rule add from Telco IP table Tel
IP route flush Table CNC
IP route add default via unicom Gateway dev ens4 src unicom ip table cnc
IP rule add from unicom IP table CNC
Double line completion (some machines need to be restarted)
Note: The first script should specify that there is no gateway to configure the network card, such as I do not configure the gateway, then the telecommunications traffic does not know so go, you can go to the default gateway, so you can pass, Unicom has a gateway naturally can pass
This article is from the "Nginx Installation Optimization" blog, please be sure to keep this source http://mrdeng.blog.51cto.com/3736360/1868016
Telecom Unicom dual-line IP Access service configuration