标签:nta htm 路径 The route add get flush main ssi
经常有这种需求,一台Linux服务器配置电信IP和网通IP,默认情况下,后启动的网卡的网关生效。南电信北网通,配置电信和网通IP,无非是为了减少网络延时,使电信用户的请求响应在电信网络中传输,网通用户的请求响应在网通网络中传输。
1
2
3
|
修改/etc/iproute2/rt_tables
252 tel #电信路由表
251 cnc #网通路由表
|
添加原路返回路由规则,注意:此处原路是广义上的说法,并不是请求的路径与响应的路径完全相同。数据包在internet传输是挺复杂的。
配置电信路由:
1
2
3
|
ip route flush table tel
ip route add default via TEL_IP_GATEWAY dev TEL_NETWORK_INTERFACE src TEL_IP_ADDRESS table tel
ip rule add from TEL_IP_ADDRESS table tel
|
配置网通路由:
1
2
3
|
ip route flush table cnc
ip route add default via CNC_IP_GATEWAY dev CNC_NETWORK_INTERFACE src CNC_IP_ADDRESS table cnc
ip rule add from CNC_IP_ADDRESS table cnc
|
实例如下:
电信IP信息:ip 183.60.139.111 netmask 255.255.255.0 gw 183.60.139.1
网通IP信息:ip 58.253.94.111 netmask 255.255.255.0 gw 58.253.94.254
eth0网卡配置电信IP,eth1网卡配置网通IP,两网卡都不要配置网关。
1
2
3
|
# vi /etc/iproute2/rt_tables 添加以下内容
252 tel
251 cnc
|
添加路由
1
2
3
4
5
6
|
# ip route flush table tel
# ip route add default via 183.60.139.1 dev eth0 src 183.60.139.111 table tel
# ip route add from 183.60.139.111 table tel
# ip route flush table cnc
# ip route add default via 58.253.94.254 dev eth1 src 58.253.94.111 table cnc
# ip route add from 58.253.94.111 table cnc
|
服务器单条网线单个网卡配置多个vlan
https://wiki.ubuntu.com/vlan?highlight=%28CategoryNetworking%29
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
# apt-get install vlan
# echo "8021q" >> /etc/modules
# vi /etc/network/interfaces
auto eth1.10
iface eth1.10 inet static
address 183.60.139.111
netmask 255.255.255.0
vlan-raw-device eth1
auto eth1.100
iface eth1.100 inet static
address 58.253.94.111
netmask 255.255.255.0
vlan-raw-device eth1
|
同时,交换机上需要允许vlan10,valn100
1
|
swithchport access valn 10 100
|
标签:nta htm 路径 The route add get flush main ssi
原文地址:https://www.cnblogs.com/mouseleo/p/10640003.html