Slashdot Mirror


ifconfig refactoring for FreeBSD

Dan writes "Based on Sam Leffer's suggestion, Bruce Simpson has been working on refactoring ifconfig(8). ifconfig is a FreeBSD unix utility used to assign an address to a network interface and/or configure network interface parameters. Bruce says that ifconfig has grown increasingly large and become unwieldy. Part of the effort has been to get a handle on all of the options that are currently supported so he has written a YACC grammar for it. He has uploaded some grammer, created a design document and also generated a PDF file you can view which shows you syntax diagrams for each part of the parse tree."

8 of 125 comments (clear)

  1. Wondering what YACC is? by a.koepke · · Score: 5, Informative

    For those of you who do not know what YACC is all about

    Its good to see something like this happening as ifconfig is not only used on FreeBSD but also on most (all?) Linux distros.

    Ifconfig is just one of the many contributions the BSD projects have given to the Linux and UNIX community.

    PS: To all those "bsd is dying" trolls, things like this show its not. Without the work of the BSD projects you wouldn't have some of the many tools you use each day.

    --


    (\(\
    (^.^)
    (")")
    *This is the cute bunny virus, please copy this into your sig so it can spread
    1. Re:Wondering what YACC is? by Anonymous Coward · · Score: 1, Informative

      The GNU version takes different arguments anyway - like for example none at all, which the FreeBSD version doesn't allow - so this will most likely not affect any Linux user in any way.

      You are an idiot.

      user@hemlock$ ifconfig
      rl0: flags=8843 mtu 1500
      inet 192.168.1.5 netmask 0xffffff00 broadcast 192.168.1.255
      inet6 fe80::248:54ff:fe85:5624%rl0 prefixlen 64 scopeid 0x1
      ether 00:48:54:85:56:24
      media: Ethernet autoselect (100baseTX )
      status: active
      lp0: flags=8810 mtu 1500
      lo0: flags=8049 mtu 16384
      inet6 ::1 prefixlen 128
      inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
      inet 127.0.0.1 netmask 0xff000000
      ppp0: flags=8010 mtu 1500
      sl0: flags=c010 mtu 552
      faith0: flags=8002 mtu 1500
      user@hemlock$

    2. Re:Wondering what YACC is? by semanticgap · · Score: 2, Informative

      The GNU version takes different arguments anyway - like for example none at all, which the FreeBSD version doesn't allow

      When was the last time you used FreeBSD?

      $ uname
      FreeBSD
      $ ifconfig
      rl0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
      inet 192.168.1.10 netmask 0xffffff00 broadcast 192.168.1.255
      [snip]

      FreeBSD has the best ifconfig of all Unices I've used. My favorite part is being albe to use the slash notation for the netmask, e.g. to add a secondary IP to fxp0, you can do:

      # ifconfig fxp0 192.168.1.12/32 alias

  2. Using ifconfig w/out arguments by RT+Alec · · Score: 5, Informative

    Starting with FreeBSD 4.x, ifconfig with no arguments simply lists all interfaces the kernel has found, and their configuration details.

    %>ifconfig
    de0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet 10.0.254.254 netmask 0xffff0000 broadcast 10.0.255.255
    ether 00:e0:29:37:09:a8
    media: Ethernet autoselect (100baseTX <full-duplex>)
    status: active
    de1: flags=8c43<UP,BROADCAST,RUNNING,OACTIVE,SIMPLEX,MU LTICAST> mtu 1500
    inet 10.1.254.254 netmask 0xffff0000 broadcast 10.1.255.255
    ether 00:e0:29:37:09:a9
    media: Ethernet autoselect
    de2: flags=8c43<UP,BROADCAST,RUNNING,OACTIVE,SIMPLEX,MU LTICAST> mtu 1500
    inet 10.2.254.254 netmask 0xffff0000 broadcast 10.2.255.255
    ether 00:e0:29:37:0c:d6
    media: Ethernet autoselect
    de3: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    inet 10.3.254.254 netmask 0xffff0000 broadcast 10.3.255.255
    ether 00:e0:29:37:0c:d7
    media: Ethernet autoselect (10baseT/UTP)
    status: active
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    inet 127.0.0.1 netmask 0xff000000
    wan0: flags=51<UP,POINTOPOINT,RUNNING> mtu 1500
    inet 219.51.254.45 --> 219.51.254.46 netmask 0xfffffffc
    %>
    (the actual output has tabs to make the formatting a little prettier)
  3. Re:How about live /etc/rc.conf changes? by changelingyahoo.com · · Score: 5, Informative

    The quick answer is "Yes, you can." In FreeBSD 5 for instance you can change a line in rc.conf and then just rerun the script for the daemon that corresponds to it. It's a bit like the init.d scripts in Linux except with a big global variables file. In FreeBSD 4 you can do it as well, but if I recall the scripts in FreeBSD 4 often lump several daemons together into a single file so you might end up restarting more than one daemon. I may be wrong, though. Brian

  4. GNU ifconfig - What? by Anonymous Coward · · Score: 5, Informative

    There is no "GNU ifconfig". Linux has it's own version which is probably based on an old BSD version, or, maybe written from scratch.

    % ifconfig -V
    net-tools 1.60
    ifconfig 1.42 (2001-04-13)

    You can tell it's not GNU because it doesn't spout on about the GPL everytime you run it.

  5. Re:How about live /etc/rc.conf changes? by phoenix_rizzen · · Score: 3, Informative

    That's already in there: /bin/sh /etc/netstart

    This reads the network settings from rc.conf and reconfigures the interfaces and routes based on that info.

  6. Linux's iproute2+tc by szap · · Score: 4, Informative
    FWIW, Linux 2.4+ has a significantly different way to access and config the kernel's network interfaces using iproute2+tc (using the commands 'ip' and 'tc') that is cleaner than the ifconfig syntax, and supports more advanced routing features (all sorts of firewalling rules and, packets queues, for instance).

    ifconfig is just the older, more compatible way to config the interfaces for those who grew up using older Linuxes and other Unices. You can do everything ifconfig + iptables using ip + tc and more.

    So before anyone claims that Linux's ifconfig sucks and is too complicated, they've already made a better replacement for it, just needs more documentation and exposure.