Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
localhost listed twice, once ureachable, why?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
agrypa1
Apprentice
Apprentice


Joined: 31 Mar 2005
Posts: 244

PostPosted: Wed Apr 07, 2010 11:29 pm    Post subject: localhost listed twice, once ureachable, why? Reply with quote

The network connection seems to be working fine. There is however a strange thing about 127.0.0.0/8 network addres.
Both route -n and ip route reveal this problem:


Code:

localhost linux # route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     5      0        0 br0
127.0.0.0       -               255.0.0.0       !     0      -        0 -
127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo
0.0.0.0         192.168.1.1     0.0.0.0         UG    5      0        0 br0


Code:

localhost linux # ip route
192.168.1.0/24 dev br0  scope link  metric 5
unreachable 127.0.0.0/8  scope host
127.0.0.0/8 via 127.0.0.1 dev lo  scope link
default via 192.168.1.1 dev br0  metric 5



here is some more:
Code:
 ip link
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:11:d8:1c:08:9e brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:11:d8:1a:1d:e9 brd ff:ff:ff:ff:ff:ff
4: tap0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
    link/ether a6:22:c7:74:02:33 brd ff:ff:ff:ff:ff:ff
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 00:11:d8:1c:08:9e brd ff:ff:ff:ff:ff:ff




Code:


localhost ~ # ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 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,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:11:d8:1c:08:9e brd ff:ff:ff:ff:ff:ff
    inet6 fe80::211:d8ff:fe1c:89e/64 scope link
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 1000
    link/ether 00:11:d8:1a:1d:e9 brd ff:ff:ff:ff:ff:ff
4: tap0: <BROADCAST,MULTICAST,PROMISC,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 500
    link/ether a6:22:c7:74:02:33 brd ff:ff:ff:ff:ff:ff
    inet6 fe80::a422:c7ff:fe74:233/64 scope link
       valid_lft forever preferred_lft forever
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN
    link/ether 00:11:d8:1c:08:9e brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.10/24 brd 192.168.1.255 scope global br0
    inet6 fe80::211:d8ff:fe1c:89e/64 scope link
       valid_lft forever preferred_lft forever


I don't know where to look in order to get to know why this is so...

Any clues?

Agryppa
_________________
The first successor of Saint Peter was Linus (a.d. 68-79) - whose namesake became the creator of Linux in our time. Torvalds' middle name is Benedict - the name assumed by the previous Pope who resigned from office.
Back to top
View user's profile Send private message
linear
Apprentice
Apprentice


Joined: 12 Aug 2004
Posts: 220

PostPosted: Thu Apr 08, 2010 5:15 pm    Post subject: Reply with quote

Greetings,

How about posting your /etc/hosts and /etc/conf.d/net, please.

HTH.
Back to top
View user's profile Send private message
agrypa1
Apprentice
Apprentice


Joined: 31 Mar 2005
Posts: 244

PostPosted: Thu Apr 08, 2010 5:21 pm    Post subject: Reply with quote

linear wrote:
Greetings,

How about posting your /etc/hosts and /etc/conf.d/net, please.

HTH.



Code:
  # /etc/hosts: Local Host Database
#
# This file describes a number of aliases-to-address mappings for the for
# local hosts that share this file.
#
# In the presence of the domain name service or NIS, this file may not be
# consulted at all; see /etc/host.conf for the resolution order.
#
#127.0.0.1   localhost.localdomain   localhost
#127.0.0.1   localhost.localdomain   localhost


## livebox TPSA
192.168.1.1 livebox
## Plip connection to debian laptop
#192.168.1.2   debian
# IPv4 and IPv6 localhost aliases

127.0.0.1   localhost
::1      localhost

#10.0.0.1 sabayonx86
#10.0.0.2 netgear
#  IPV6 versions of localhost and co
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
#
# Imaginary network.
#10.0.0.2               myname
#10.0.0.3               myfriend
#
# According to RFC 1918, you can use the following IP networks for private
# nets which will never be connected to the Internet:
#
#       10.0.0.0        -   10.255.255.255
#       172.16.0.0      -   172.31.255.255
#       192.168.0.0     -   192.168.255.255
#
# In case you want to be able to connect directly to the Internet (i.e. not
# behind a NAT, ADSL router, etc...), you need real official assigned
# numbers.  Do not try to invent your own network numbers but instead get one
# from your network provider (if any) or from your regional registry (ARIN,
# APNIC, LACNIC, RIPE NCC, or AfriNIC.)
#
 


Code:
 #-----------------------------------------------------------------------------
# Bridging (802.1d)
# For bridging support emerge net-misc/bridge-utils

# To add ports to bridge br0
#bridge_br0="eth0 eth1"
bridge_br0="eth0 tap0"

# or dynamically add them when the interface comes up
#bridge_add_eth0="br0"
#bridge_add_tap0="br0"
#bridge_add_eth1="br0"

# You need to configure the ports to null values so dhcp does not get started
config_eth0="null"
config_tap0="null"

# Finally give the bridge an address - dhcp or a static IP
config_br0="dhcp" # may not work when adding ports dynamically

#config_br0="192.168.0.1/24"

# If any of the ports require extra configuration - for example wireless or
# ppp devices - we need to depend on them like so.
rc_need_br0="net.eth0 net.tap0"

# Below is an example of configuring the bridge
# Consult "man brctl" for more details
#brctl_br0="setfd 0
#brctl_br0="sethello 0"
#brctl_br0="stp on"

 

_________________
The first successor of Saint Peter was Linus (a.d. 68-79) - whose namesake became the creator of Linux in our time. Torvalds' middle name is Benedict - the name assumed by the previous Pope who resigned from office.
Back to top
View user's profile Send private message
sera
Retired Dev
Retired Dev


Joined: 29 Feb 2008
Posts: 1017
Location: CET

PostPosted: Thu Apr 08, 2010 9:40 pm    Post subject: Reply with quote

Are you using baselayout2, then have a look at the content of /etc/init.d/network. The reason is there, a good answer why this is as it is and if it has to be like this I'm still lacking.
Back to top
View user's profile Send private message
agrypa1
Apprentice
Apprentice


Joined: 31 Mar 2005
Posts: 244

PostPosted: Sat Apr 10, 2010 3:34 pm    Post subject: Reply with quote

sera wrote:
Are you using baselayout2, then have a look at the content of /etc/init.d/network. The reason is there, a good answer why this is as it is and if it has to be like this I'm still lacking.




Hi,
All entried in /etc/init.d/network are commented out. So I guess there is nothing there affecting my system. Yes I am using baselayout-2

Agryppa
_________________
The first successor of Saint Peter was Linus (a.d. 68-79) - whose namesake became the creator of Linux in our time. Torvalds' middle name is Benedict - the name assumed by the previous Pope who resigned from office.
Back to top
View user's profile Send private message
sera
Retired Dev
Retired Dev


Joined: 29 Feb 2008
Posts: 1017
Location: CET

PostPosted: Sat Apr 10, 2010 5:01 pm    Post subject: Reply with quote

agrypa1 wrote:
All entried in /etc/init.d/network are commented out.

Do you by any chance confuse /etc/init.d/network with /etc/conf.d/network?

However, there is a function start() with an if statement of uname = linux, then add route to localhost twice. Essentially covering the first of those.

I'm again not at a baselayout2 machine, so again no quote of the relevant code snippet. Sorry.
Back to top
View user's profile Send private message
agrypa1
Apprentice
Apprentice


Joined: 31 Mar 2005
Posts: 244

PostPosted: Sat Apr 10, 2010 7:25 pm    Post subject: Reply with quote

Ok, here is the start() function from baselayout-2 that I have on my machine:

Code:
   
start()
{
   local cr=0 r= int= intv= cmd= args= upcmd=

   if [ -z "$domainname" -a -s /etc/defaultdomain ]; then
      domainname=$(cat /etc/defaultdomain)
   fi
   if [ -n "$domainname" ]; then
      ebegin "Setting NIS domainname: $domainname"
      domainname "$domainname"
      eend $?
   fi

   einfo "Starting network"
   routeflush
   if [ "$RC_UNAME" = "Linux" ]; then
      ifconfig lo 127.0.0.1 netmask 255.0.0.0 || cr=1
      route add -net 127.0.0.0 netmask 255.0.0.0 \
         gw 127.0.0.1 2>/dev/null
      route add -net 127.0.0.0 netmask 255.0.0.0 \
         gw 127.0.0.1 reject 2>/dev/null
   else
      ifconfig lo0 127.0.0.1 netmask 255.0.0.0 || cr=1
      route -q add -inet 127.0.0.0 -netmask 255.0.0.0 \
         127.0.0.1 -reject || cr=1
   fi
   eindent
   for int in $(interfaces); do
      local func= cf=
      intv=$(shell_var "$int")
      eval upcmd=\$ifup_$intv
      for func in ip ifconfig; do
         eval cmd=\$${func}_$intv
         if [ -n "$cmd" -o -f /etc/"$func.$int" ]; then
            cf=/etc/"$func.$int"
            break
         fi
      done
      [ -n "$cf" -o -n "$upcmd" -o \
         -f /etc/ifup."$int" -o -f "$cf" ] || continue
      veinfo "$int"
      case "$func" in
      ip)   func=runip; intup=false;;
      esac
      eindent
      runargs /etc/ifup."$int" "$upcmd"
      r=0
      dumpargs "$cf" "$cmd" | while read -r args; do
         case "$args" in
         ''|"#"*)   ;;
         "!"*)
               (
                   eval vebegin "${args#*!}"
                  eval "${args#*!}"
                  veend $?
               );;
         *)
               (
                   set -o noglob
                  eval set -- "$args"
                  vebegin "$@"
                  $func "$int" "$@"
                  veend $?
               );;
         esac
      done
      eoutdent
   done
   eoutdent
   eend $cr

   # Wait for any inet6 tentative addresses
   r=5
   while [ $r -gt 0 ]; do
      tentative || break
      sleep 1
      r=$(($r - 1))
   done
   
   if [ -n "$defaultroute" ]; then
      ebegin "Setting default route $defaultroute"
      route add default $defaultroute
      eend $?
   elif [ -n "$defaultiproute" ]; then
      ebegin "Setting default route $defaultiproute"
      ip route add default $defaultiproute
      eend $?
   fi

   if [ -n "$defaultroute6" ]; then
      ebegin "Setting default route $defaultroute6"
      if [ "$RC_UNAME" = Linux ]; then
         routecmd="route -A inet6 add"
      else
         routecmd="route -inet6 add"
      fi
      $routecmd default $defaultroute6
      eend $?
   elif [ -n "$defaultiproute6" ]; then
      ebegin "Setting default route $defaultiproute6"
      ip -f inet6 route add default $defaultiproute6
      eend $?
   fi

   return 0
}




In your last post did you mean I should add or substract an addition of a route to localhost?

thanks

Agryppa
_________________
The first successor of Saint Peter was Linus (a.d. 68-79) - whose namesake became the creator of Linux in our time. Torvalds' middle name is Benedict - the name assumed by the previous Pope who resigned from office.
Back to top
View user's profile Send private message
Ant P.
Watchman
Watchman


Joined: 18 Apr 2009
Posts: 6714

PostPosted: Sat Apr 10, 2010 9:29 pm    Post subject: Reply with quote

The reject rule is there so loopback traffic never accidentally goes out via the default 0.0.0.0 route. That would be bad.
Back to top
View user's profile Send private message
sera
Retired Dev
Retired Dev


Joined: 29 Feb 2008
Posts: 1017
Location: CET

PostPosted: Sat Apr 10, 2010 9:31 pm    Post subject: Reply with quote

Code:
if [ "$RC_UNAME" = "Linux" ]; then
      ifconfig lo 127.0.0.1 netmask 255.0.0.0 || cr=1
      route add -net 127.0.0.0 netmask 255.0.0.0 \
         gw 127.0.0.1 2>/dev/null
      route add -net 127.0.0.0 netmask 255.0.0.0 \
         gw 127.0.0.1 reject 2>/dev/null


This snippet is the reason for the unreachable route. The second call to route makes the first unavailable. All I can say about it is it looks like a workaround for a problem unknown to me and the developer did it intentionally.
Back to top
View user's profile Send private message
sera
Retired Dev
Retired Dev


Joined: 29 Feb 2008
Posts: 1017
Location: CET

PostPosted: Sat Apr 10, 2010 9:34 pm    Post subject: Reply with quote

Ant_P wrote:
The reject rule is there so loopback traffic never accidentally goes out via the default 0.0.0.0 route. That would be bad.


Questionable is the first call to route.
Back to top
View user's profile Send private message
agrypa1
Apprentice
Apprentice


Joined: 31 Mar 2005
Posts: 244

PostPosted: Sat Jun 12, 2010 1:58 pm    Post subject: Reply with quote

sera wrote:
Ant_P wrote:
The reject rule is there so loopback traffic never accidentally goes out via the default 0.0.0.0 route. That would be bad.


Questionable is the first call to route.



I continue to have problems and struggle with the unreachable route mentioned at the start of the thread. Perhaps I will post what's going on here again:

Code:
ip route show scope host
unreachable 127.0.0.0/8


the above is the error i would like to wipe out.

And here is what happens in the local table:

Code:
ip route show table local
broadcast 192.168.1.0 dev br0  proto kernel  scope link  src 192.168.1.12
broadcast 127.255.255.255 dev lo  proto kernel  scope link  src 127.0.0.1
broadcast 192.168.1.255 dev br0  proto kernel  scope link  src 192.168.1.12
local 192.168.1.12 dev br0  proto kernel  scope host  src 192.168.1.12
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


and yet another:

Code:
ip route show scope global
127.0.0.0/8 via 127.0.0.1 dev lo
default via 192.168.1.1 dev br0  metric 6


The file etc/init.d/network is posted earlier in this thread so please review it there.

any clues for me, maybe?

Agryppa
_________________
The first successor of Saint Peter was Linus (a.d. 68-79) - whose namesake became the creator of Linux in our time. Torvalds' middle name is Benedict - the name assumed by the previous Pope who resigned from office.
Back to top
View user's profile Send private message
NightMonkey
Guru
Guru


Joined: 21 Mar 2003
Posts: 330
Location: Pittsburgh, PA

PostPosted: Sun Aug 21, 2011 11:25 pm    Post subject: Reply with quote

Yep, old thread, but never answered it seems. :) I'm wondering the same thing. What is the purpose of this reject route, in the context of the other hardcoded localhost routes in /etc/init.d/net.lo? Why not rather explicitly setup a localhost net (127.0.0.0/8) route to go over localhost?

Is the dev who implemented this available to nicely educate us? :) Thanks in advance.
_________________
:D
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum