Simple routing question about my setup

Discussion in 'Linux Networking' started by Ken Williams, Jun 29, 2004.

  1. Ken Williams

    Ken Williams Guest

    When I bootup this is what sets up my network/eth0.

    # Network Block: 49.90.8.176 / 28

    # Add loopback
    /sbin/ifconfig lo 127.0.0.1
    /sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo

    # Ethernet Config Info
    IPADDR="49.90.8.180"
    NETMASK="255.255.255.240"
    NETWORK="49.90.8.176"
    BROADCAST="49.90.8.191"
    GATEWAY="49.90.8.177"

    /sbin/ifconfig eth0 ${IPADDR} broadcast ${BROADCAST} netmask ${NETMASK}
    /sbin/route add -net ${NETWORK} netmask ${NETMASK} dev eth0
    /sbin/route add default gw ${GATEWAY} netmask 0.0.0.0 metric 1

    It results in this (route command output):

    Kernel IP routing table
    Destination Gateway Genmask Flags Metric Ref Use Iface
    49.90.8.176 0.0.0.0 255.255.255.240 U 0 0 0 eth0
    49.90.8.176 0.0.0.0 255.255.255.240 U 0 0 0 eth0
    49.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 eth0
    127.0.0.0 0.0.0.0 255.0.0.0 U 0 0 0 lo
    0.0.0.0 69.90.8.177 0.0.0.0 UG 1 0 0 eth0


    What is causing the net 49.0.0.0 netmask 255.0.0.0 to be there? I need to
    remove that, I know I can do a "route del -net..." but I don't want it to be
    there to begin with at bootup. What do I have to change to get rid of that?
    Its causing all packets from any ip thats starts with 49. to go nowhere.

    This is linux 2.4.26/slackware 9.1.

    Thanks.
     
    Ken Williams, Jun 29, 2004
    #1
    1. Advertisements

  2. I'm not entirely sure, but I would consider altering the netmask of 0.0.0.0
    in your last route add default to 255.255.255.255, meaning that all other
    traffic would go thru your gateway.

    --
    GerardLinux ay tee filternet dee oo tee ann el

    |
    \ /
    .---.
    '-. | | .-'
    ___| |___
    -= [ ] =-
    `---. .---'
    __||__ | | __||__
    '-..-' | | '-..-'
    || | | ||
    ||_.-| |-,_||
    .-"` `"`'` `"-.
    .' '.

    Jesus is alive, I spoke with Him this morning!
     
    Gerard Wassink, Jun 30, 2004
    #2
    1. Advertisements

  3. (Ken Williams) wrote in

    I noticed sometimes network configuration is set in several files.
    In my box, I have /etc/sysconfig/network and /etc/sysconfig/network-
    scripts/ifcfg-eth0.
    I never remember the right files, so when I make some changes, I often use
    grep -r(ecursive) with some keywords to find which file I have to modify.

    $ pwd
    /etc/sysconfig
    $ grep -r MASK= *
    networking/ifcfg-lo:NETMASK=255.0.0.0
    network-scripts/ifcfg-lo:NETMASK=255.0.0.0
    network-scripts/ifup-aliases: echo default_NETMASK=$NETMASK\;;
    network-scripts/ifup-aliases: NETMASK=$default_NETMASK
    network-scripts/ifcfg-eth0:NETMASK=255.255.255.192
    [[email protected] sysconfig]# grep -r MASK= *|more
    networking/ifcfg-lo:NETMASK=255.0.0.0
    network-scripts/ifcfg-lo:NETMASK=255.0.0.0
    network-scripts/ifup-aliases: echo default_NETMASK=$NETMASK\;;
    network-scripts/ifup-aliases: NETMASK=$default_NETMASK
    network-scripts/ifcfg-eth0:NETMASK=255.255.255.192
    $

    I hope this could help.

    Ciao.
     
    daniele di mattia, Jun 30, 2004
    #3
  4. No, the default route has a netmask of 0.0.0.0, that is what makes it the
    default route. A netmask of 255.255.255.255 would route no traffic except
    that destined for the target itself down that route, and as the target is
    0.0.0.0 that means nothing.

    The 49/8 route (the one with the 255.0.0.0 netmask) being there looks as
    though something has set up the interface with the IP address and no
    netmask. This would default to /8 - 49 would have been class A and
    classfulness is still the default if the netmask isn't specified. But
    there isn't anything in the above which would do that. Is anything issuing
    "ifconfig eth0 49.90.8.180" alone with no netmask?

    Regards, Ian
     
    Ian Northeast, Jun 30, 2004
    #4
  5. Ken Williams

    Ken Williams Guest

    Yes, your right. I just figured it out too. I left it out because I didn't
    think it mattered, but I had some other "alias" IPs being setup too that
    looked like:

    /sbin/ifconfig eth0:0 49.90.8.181
    /sbin/route add -host 49.90.8.181 dev eth0:0

    without the netmask. I added a netmask so it looked like

    /sbin/ifconfig eth0:0 69.90.8.181 netmask 255.255.255.240
    /sbin/route add -host 69.90.8.181 dev eth0:0

    and everything came up properly. Thanks for your post anyway.
     
    Ken Williams, Jul 1, 2004
    #5
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.