Traffic Server
  1. Traffic Server
  2. TS-355

Autodetect default network interface

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.1.3
    • Component/s: Build
    • Labels:
      None

      Description

      Currently we instruct the user to specify the cluster interface as part of build procedure (see INSTALL)
      We can detect the interface automatically on some platforms
      Linux
      /sbin/ifconfig -a | grep ^e.* | head -1 | awk '

      {print $1;}'
      Solaris, FreeBsd (probably OSX)
      /sbin/ifconfig -a | grep -v LOOPBACK | grep UP | head -1 | awk -F: '{print $1;}

      '

      Additional configure option (--with-cluster-interface=IFACE) can be added to explicitly
      specify some other interface.

        Activity

        Hide
        Mladen Turk added a comment -

        More correct Linux script
        /sbin/ifconfig | sed 's/^ *$/CRLF/g' | tr '\n' ' ' | sed 's/CRLF /\n/g' | grep -v LOOPBACK | grep 'UP.*RUNNING' | head -1 | awk '

        {print $1;}

        '
        Complex because info spreads across multiple lines, so we create one line for each iface block and then grep

        For Solaris, BSD, Mac
        /sbin/ifconfig -a | grep 'UP.*RUNNING' | grep -v LOOPBACK | head -1 | awk -F: '

        { print $1;}

        '

        Show
        Mladen Turk added a comment - More correct Linux script /sbin/ifconfig | sed 's/^ *$/CRLF/g' | tr '\n' ' ' | sed 's/CRLF /\n/g' | grep -v LOOPBACK | grep 'UP.*RUNNING' | head -1 | awk ' {print $1;} ' Complex because info spreads across multiple lines, so we create one line for each iface block and then grep For Solaris, BSD, Mac /sbin/ifconfig -a | grep 'UP.*RUNNING' | grep -v LOOPBACK | head -1 | awk -F: ' { print $1;} '
        Hide
        Leif Hedstrom added a comment -

        We should fix this together with TS-327 as well. Meaning, we should handle the 'wrong' setting better as well.

        Show
        Leif Hedstrom added a comment - We should fix this together with TS-327 as well. Meaning, we should handle the 'wrong' setting better as well.
        Hide
        Leif Hedstrom added a comment -

        I noticed that above is in the autoconf code right now, are we happy with that as a reasonable "solution" ? Since we do provide a default now, based on the build box environment, it's kind of a moot point to try to "guess" at run-time, so maybe just fix TS-327 instead (to have better errors when the interface is wrong).

        Also, I'm wondering if something like this (on linux at least) would make more sense:

        /sbin/ip route | awk '/default/

        {print $5}

        That makes the default interface in the config be the same interface as used for the default route on the build box. It still has the same issue as mentioned above though.

        Show
        Leif Hedstrom added a comment - I noticed that above is in the autoconf code right now, are we happy with that as a reasonable "solution" ? Since we do provide a default now, based on the build box environment, it's kind of a moot point to try to "guess" at run-time, so maybe just fix TS-327 instead (to have better errors when the interface is wrong). Also, I'm wondering if something like this (on linux at least) would make more sense: /sbin/ip route | awk '/default/ {print $5} That makes the default interface in the config be the same interface as used for the default route on the build box. It still has the same issue as mentioned above though.
        Hide
        Leif Hedstrom added a comment -

        it looks like this logic is already in the autoconf system (to pick a "reasonable" default interface), so closing this for now. I'll work on TS-327 and see if we can get a little better feedback there on failures.

        Show
        Leif Hedstrom added a comment - it looks like this logic is already in the autoconf system (to pick a "reasonable" default interface), so closing this for now. I'll work on TS-327 and see if we can get a little better feedback there on failures.

          People

          • Assignee:
            Mladen Turk
            Reporter:
            Mladen Turk
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 24h
              24h
              Remaining:
              Remaining Estimate - 24h
              24h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development