在Linux环境中,“ip Route”命令的顺序会影响路由吗?

在Linux环境中,“ip Route”命令的顺序会影响路由吗?

我将多个以太网连接到服务器,一个用于 LAN,其余用于 PPPOE。连接到每个 PPPOE 的每个数据包都是自己发送的。它在 CentOS 6.10 上运行良好。

在 8 系列中,数据包通过默认 LAN 路由。MIRACLE LINUX 是与 RHEL 兼容的发行版。

我很好奇“ip route”的结果顺序。那怎么样?

# cat /etc/redhat-release
CentOS release 6.10 (Final)

# cat /etc/iproute2/rt_tables | grep -v "^#\|^$"
255     local
254     main
253     default
0       unspec
100  tbl_ppp0

# ip route
C.C.C.C dev ppp0  proto kernel  scope link  src A.A.A.A
169.254.0.0/16 dev eth0  scope link  metric 1002
default via 192.168.1.1 dev eth0

# ip route show table tbl_ppp0
default via A.A.A.A dev ppp0

# ip rule | grep tbl_ppp0
27373:  from A.A.A.A lookup tbl_ppp0

# cat /etc/squid/acl.conf  | grep ppp0
http_port A.A.A.A:3128 name=ppp0_IP
acl ppp0_acl myportname ppp0_IP
tcp_outgoing_address A.A.A.A ppp0_acl

# curl -s -m 2 http://ifconfig.co/ip -x A.A.A.A:3128
A.A.A.A
# tail /var/log/squid/access.log | grep A.A.A.A
1688498713.497    260 A.A.A.A TCP_MISS/200 683 GET http://ifconfig.co/ip - DIRECT/172.64.163.15 text/plain

 

# cat /etc/redhat-release
MIRACLE LINUX release 8.7 (Peony)

# cat /etc/iproute2/rt_tables |  grep -v "^#\|^$"
255     local
254     main
253     default
0       unspec
100 tbl_ppp0

# ip route
default via 172.20.0.1 dev enp1s0
169.254.0.0/16 dev enp1s0 scope link metric 1002
172.20.0.0/24 dev enp1s0 proto kernel scope link src 172.20.0.104
C.C.C.C dev ppp0 proto kernel scope link src B.B.B.B

# ip route show table tbl_ppp0
default via B.B.B.B dev ppp0

# ip rule | grep tbl_ppp0
32615:  from B.B.B.B lookup tbl_ppp0

# cat /etc/squid/acl.conf  | grep ppp0
http_port B.B.B.B:3128 name=ppp0_IP
acl ppp0_acl myportname ppp0_IP
tcp_outgoing_address B.B.B.B ppp0_acl

# curl -s -m 2 http://ifconfig.co/ip -x B.B.B.B:3128
X.X.X.X        ← this ip is enp1s0
# tail /var/log/squid/access.log | grep B.B.B.B
1688498755.023    282 B.B.B.B TCP_MISS/200 681 GET http://ifconfig.co/ip - HIER_DIRECT/172.64.163.15 text/plain

相关内容