Page 1 of 1

Why 'ip route get 127.0.0.5' command shows diffrent result between CentOS6 and CentOS7?

Posted: 2020/06/10 01:13:50
by dhlee

Code: Select all

CentOS6 minimal server
# ip route get 127.0.0.5
local 127.0.0.5 dev lo src 127.0.0.5
  cache <local> mtu 65520 hoplimit 64

CentOS7 minimal server
# ip route get 127.0.0.5
local 127.0.0.5 dev lo src 127.0.0.1
  cache <local>
Why the src IP address is different?

Re: Why 'ip route get 127.0.0.5' command shows diffrent result between CentOS6 and CentOS7?

Posted: 2020/06/10 08:23:22
by TrevorH
I'd guess that you've also assigned that 127.0.0.5 ip address to your lo interface as I do not get the same result here. My result on CentOS 7.8 is the same as your 6.x one.

Re: Why 'ip route get 127.0.0.5' command shows diffrent result between CentOS6 and CentOS7?

Posted: 2020/06/10 10:09:42
by jlehtone
Interesting:

Code: Select all

CentOS 6# ip route get 127.0.0.5
local 127.0.0.5 dev lo  src 127.0.0.5 
    cache <local>  mtu 65520 hoplimit 64

CentOS 7# ip route get 127.0.0.5
local 127.0.0.5 dev lo src 127.0.0.1 
    cache <local> 

CentOS 8# ip route get 127.0.0.5
local 127.0.0.5 dev lo src 127.0.0.1 uid 1000 
    cache <local> 
These machines do not have anything custom on lo.

@dhlee: I think you have mislabeled your output. That is why Trevor's 7 gives same as your "6".

The kernel of CentOS 6 is derived from 2.6.32.
The kernel of CentOS 7 is derived from 3.10.0.

The older kernel probably differs in its network stack.

The routing table 'local' contains in 6:

Code: Select all

broadcast 127.0.0.0 dev lo  proto kernel  scope link  src 127.0.0.1 
local 127.0.0.1 dev lo  proto kernel  scope host  src 127.0.0.1 
local 127.0.0.0/8 dev lo  proto kernel  scope host  src 127.0.0.1
but apparently that is not what the truth is.

Re: Why 'ip route get 127.0.0.5' command shows diffrent result between CentOS6 and CentOS7?

Posted: 2020/06/11 00:41:34
by dhlee
I'm sorry, you're right. I've mislabeled the result.

And here is additional information.

I am really curious why this is happening.


CentOS 6 - CentOS release 6.9 (Final) / 2.6.32

Code: Select all

[root@localhost ~]# cat /etc/redhat-release 
CentOS release 6.9 (Final)
[root@localhost ~]# uname -a
Linux localhost.localdomain 2.6.32-696.el6.i686 #1 SMP Tue Mar 21 18:53:30 UTC 2017 i686 i686 i386 GNU/Linux
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether ##:##:##:##:##:## brd ff:ff:ff:ff:ff:ff
    inet ##.##.##.##/24 brd ##.##.##.## scope global eth0
    inet6 ####::###:####:####:####/64 scope link 
       valid_lft forever preferred_lft forever
[root@localhost ~]#ip route get 127.0.0.5
local 127.0.0.5 dev lo  src 127.0.0.5 
    cache <local>  mtu 65520 hoplimit 64
[root@localhost ~]#

CentOS 7 - CentOS release 7.4.1708 (Core) / 3.10.0

Code: Select all

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether ##:##:##:##:##:## brd ff:ff:ff:ff:ff:ff
    inet ##.##.##.##/24 brd ##.##.##.## scope global enp0s3
       valid_lft forever preferred_lft forever
    inet6 ####::###:####:####:####/64 scope link 
       valid_lft forever preferred_lft forever
[root@localhost ~]#ip route get 127.0.0.5
local 127.0.0.5 dev lo src 127.0.0.1 
    cache <local> 
[root@localhost ~]#

Re: Why 'ip route get 127.0.0.5' command shows diffrent result between CentOS6 and CentOS7?

Posted: 2020/06/11 09:39:34
by TrevorH
Your systems are badly out of date and need a yum update run. CentOS 6.9 dates from 2017 as does CentOS 7.4. Both are riddled with high severity security vulnerabilities and are not safe to run. You need to update them to the current versions ASAP.