hubertf's NetBSD Blog
Send interesting links to hubert at feyrer dot de!
 
[20070816] Network auto-detection scripts
Some time ago I had to redo the network auto-detection scripts on my laptop when the harddisk crashed and I had no backup. Here's an attempt at documenting things.

The picture: My laptop has an ethernet and a wireless card, tlp0 and ath0. Ethernet can be plugged in at times, and should have precedence over wireless -- this is mostly to prevent a wifi network bouncing up and down interrupting operating via the cable. Wireless can be configured in several ways, including no security, WEP or WPA.

The machine should try to find network when waking up from APM, when ethernet is plugged in, or when a wireless network is found (using whatever SSID).

The idea is to use wpa_supplicant(8) to detect wifi networks and mark the ath0 interface as "connected". NetBSD's ifwatchd(8) is used to detect if either ethernet or wifi is "connected" or disconnected when the machine's either running, or returning from sleep. A shell script then runs dhcp and does assorted setup and cleanup.

The main engine in this setup is ifwatchd(8), which basically handles all the work that's either induced by kicking wpa_supplicant(8) via APM, wpa_supplicant(8) finding a working wifi network, or by plugging in/out an ethernet cable.

The configuration:

  1. /etc/rc.conf:
    apmd=yes
    wpa_supplicant=yes
    wpa_supplicant_flags="-B -iath0 -c/root/wpa.conf"
    ifwatchd=yes
    ifwatchd_flags="-c /root/ifwatch-up -n /root/ifwatch-down tlp0 ath0" 

  2. WPA supplicant config: /root/wpa.conf

    Here's a sample config file for wpa_supplicant(8) that I use for University, home and another place. Note that the WPA in there is a bit more complex than in a home-setup with just a pre-shared key (PSK):

    % cat /root/wpa.conf
    ctrl_interface=/var/run/wpa_supplicant
    ctrl_interface_group=wheel
    
    #
    # WPA-enabled network with identities 
    # (used at uni-regensburg.de and fh-regensburg.de)
    #
    network={
            ssid="802.11i"
            key_mgmt=WPA-EAP
            eap=TTLS
            identity="abc12345"
            password="foobar"
            phase2="auth=PAP"
    }
    
    #
    # An unencrypted (open) network:
    #
    network={
            ssid="eyeswideshut"
            scan_ssid=1
            key_mgmt=NONE
    }
    
    #
    # A WEP-encrypted network with pre-shared key:
    #
    network={
           ssid="wepssid"
           scan_ssid=1
           key_mgmt=NONE
           wep_key0="wepkey"
           #wep_tx_keyidx=0
           #priority=5
    } 

  3. Watching interfaces: /root/ifwatch-updown

    ifwatchd(8) can't pass parameters, so I'm using two different scripts, and then look at $0 to see if we're going up or down:

    % ls -la /root/ifwatch-*
    lrwxr-xr-x  1 root  wheel   14 Mar 10 12:27 /root/ifwatch-down -> ifwatch-updown
    lrwxr-xr-x  1 root  wheel   14 Mar 10 12:27 /root/ifwatch-up -> ifwatch-updown
    -rwxr-xr-x  1 root  wheel  760 Aug 16 11:45 /root/ifwatch-updown
    
    Here is the script that handles ethernet and wifi networks going up and down:

    % cat /root/ifwatch-updown
    #!/bin/sh
    #
    # See if network is going up or down, to be called via ifwatchd(8)
    #
    # Copyright (c) 2007 Hubert Feyrer <hubert@feyrer.de>
    # All rights reserved.
    #
    
    case $0 in
    *-up)
            case $1 in
            tlp*)
                    # Disable wireless bouncing up and down if we're on wire
                    #
                    logger stopping wpa_supplicant
                    sh /etc/rc.d/wpa_supplicant stop
                    ;;
            esac
    
            pkill dhclient
            sh /etc/rc.d/network restart
            dhclient $1
            sh /etc/rc.d/ntpd restart
            ;;
    
    *-down)
            case $1 in
            tlp*)
                    # Re-enable wireless if we go off-wire
                    #
                    logger starting wpa_supplicant
                    sh /etc/rc.d/wpa_supplicant start
                    ;;
            esac
    
            pkill -x ssh
            sh /etc/rc.d/ntpd stop
    
            pkill dhclient
    
            sh /etc/rc.d/network stop
            route delete 194.95.108.0/24
            ;;
    
    *)
            logger "$0 $@": unknown 
            ;;
    esac
    
    logger "$0 $@" done.
    echo ^G >/dev/console
    

    A few comments:

    • As the comment says, if the ethernet interface (tlp) is found to be connected, wpa_supplicant(8) is stopped to prevent it from bouncing up and down and possibly disrupt things.
    • I stop the network at every time, to flush routes and everything. This mostly works, but not completely, thus I remove one route manually. Someone please fix "route flush"...
    • I use NTP, and to prevent ntpd(8) from spamming the logs when offline, I disable it when offline.
    • When network goes away, I kill my ssh sessions. I prefer this over dead sessions that I have to kill with ~.
    • The echo-command in the last line sends a beep with ^G to give a signal that network's up/down now.

  4. APM setup:

    During my experiments, wpa_supplicant(8) died during suspend/resume, I thus stop it before suspending, and start after resuming. This may also have positive effects on power consumption (if not it should probably be hooked in here). My machine uses APM, and I mostly use /usr/share/examples/apm/script, see that file for install instructions.

    Here's the diff that I use to handle wpa_supplicant - dhclient is restarted via ifwatchd:

    % diff -u /usr/share/examples/apm/script /etc/apm/battery
    --- /usr/share/examples/apm/script      2003-03-11 15:56:54.000000000 +0100
    +++ /etc/apm/battery    2007-03-10 12:57:21.000000000 +0100
    @@ -25,7 +25,7 @@
     S=/usr/X11R6/share/kde/sounds
     
     # What my network card's recognized as:
    -if=ne0
    +if=ath0
     
     LOGGER='logger -t apm'
     
    @@ -43,8 +43,11 @@
            # In case some NFS mounts still exist - we don't want them to hang:
            umount -a    -t nfs
            umount -a -f -t nfs
    -       ifconfig $if down
    -       sh /etc/rc.d/dhclient stop
    +
    +       sh /etc/rc.d/wpa_supplicant stop
    +
    +       cd /usr/tmp ; make off
    +
            $LOGGER 'Suspending done.'
            ;;
     
    @@ -62,7 +65,9 @@
     *resume)
            $LOGGER 'Resuming...'
            noise $S/KDE_Startup.wav
    -       sh /etc/rc.d/dhclient start
    +
    +       sh /etc/rc.d/wpa_supplicant start
    +
            # mount /home
            # mount /data
            $LOGGER 'Resuming done.'
    

    The "make off" when shutting down the machine unmounts the cgf-encrypted data partition that I'm using for SSH and PGP keys. I manually mount it when I need it again.

With these four steps -- rc.conf, wpa.conf, ifwatch-script, and APM script -- things should be in place to auto-detect cable and wifi networks, and get things online.

The future -- more work on this would include adding ACPI/powerd(8) scripts, and putting all of this either into the default NetBSD install, or at least into NetBSD's /usr/share/examples.

[Tags: , , , , , , ]



[20070715] Catchup: bootprops, pkgsrc logo and security, Chaos Singularity, ... (Updated)
OK, so I was lazy (busy :) again the past few weeks. Here's another big catch-up of the miracles that happened in NetBSD and pkgsrc land:

Enjoy!

Update: Thomas Bieg has made a webpage that documents the progress of his logo suggestion.

[Tags: , , , , , ]



[20070214] Force10 Networks uses NetBSD to build Software Scalability into FTOS Operating System (Update #4)
OK, citing from the news item I've managed to get up on our webserver, despite some hassles:

``Force10 Networks® has leveraged NetBSD® as the foundation for the Force10 Operating System (FTOS). Based on the open source UNIX-like system, FTOS provides the software scalability and resiliency that powers the Force10 TeraScale E-Series® family of switch/routers. See our full press release for more details.

Some technical details that did not make it into the press release: Today, many of the worlds largest Gigabit Ethernet and 10 Gigabit Ethernet networks depend on Force10 Networks. The Force10 TeraScale E-Series switches/routers support this by providing features like massive scalability, 1260 Gigabit Ethernet ports or 224 Ten Gigabit Ethernet ports per chassis. The machines are battle tested and provide full function L2 switching and L3 routing.

Internally, they are equipped with PowerPC CPUs, and for communication, dedicated 100M Ethernet networks are used in each system that connect the Route Processor Module (RPM) and line cards that are for system control. There are three active CPUs on the primary RPM, and a CPU on each line card that are all active in the control plane.

While data itself is forwarded by the hardware, management overhead exists if you consider running 1.500 VRRP groups, 600 OSPF neighbors, BFD on thousands of ports, ARPs on thousands of ports, collecting statistics on thousands of ports etc. All this work is done by the Force10 Operating System, FTOS''.


Force10 Networks
TeraScale E-Series Products
The release of this was coordinated for today with Force10 Networks, and I'm told that the same press release will occur on several news sites. I'll put some URLs here when I know them. :)

Update: The news item is now on the Force10 Networks frontpage, and also available as press release from their site in HTML and in PDF. It's also available on BusinessWire.

Update #2: There's another text that seems to be written down from the announcement with some Linux-babble put in at Linuxworld Update #3: The Linuxworld text was now published on NetworkWorld. Same author, same Linux-babble. Update #4: OSNEWS has an item on it too, including user comments.

[Tags: , , ]



[20070116] More fighting ssh password guessing attempts (Updated)
About one year ago (coincidence?) there was some discussion about how to protect your server against ssh password guessing, see elsewhere in my blog. Apparently the topic came up again, for ssh and other services this time, and quite a number of people chimed in and mentioned their preferred solutions to the same old problem. Solutions fall into three categories: administrative settings, logfile-parsing, and PAM-based solutions.

Administrative policies to using password-less ssh logins only is something that needs some adjusting from users.

Most of the mentioned programs parse logfiles and then act on them. Among them are fail2ban, denyhost and a similar script, OSsec, blockhosts and a shell-based approach by Rhialto.

The latter post also mentions going the PAM way, which hooks right into the authentication framework and can detect repeated authentication failures best - at the place where they get detected first. This is implemented by the anti-bruteforce PAM module in pkgsrc/security/pam-af.

I guess that's some food for thoughts, and a lot of programs to do the job. Let's see what comes up in Jan 2008 for this topic... :-)

Update: Elad Efrat wrote me to tell that server site log parsing may not be such a good idea as it has a potential to open up for some nasty attacks, see this thread on the fulldisclosuer list. You've been warned!

[Tags: , , , , ]



[20061124] TCPv6 Transmit Segment Offload (TSO) support in hardware
Work performed by TCP/IP networking stacks include many tasks, among them are calculation of packet checksums and splitting of "big" packets that exceed the hardware's maximum transport unit (MTU) into smaller, MTU-sized packets. The latter process is called fragmentation, and re-assembly of the fragmented packet on the receiving side has to be done as well, before the original 'big' packet can be processed.

Modern network cards can do a lot of things in hardware today, and -- depending on the card! -- some do support calculating checksums for IP, TCP and UDP for both IPv4 and IPv6, and some even support packet fragmentation. The latter is known as TCP segmentation offloading (TSO), as it reduces the load on the hosts's CPU by moving the job to the network card.

NetBSD supports calculating of various checksums in hardware for quite some time now (see the {ip,tcp,udp}{4,6}sum options in ifconfig(8)), and support for TSO is available for TCP/IPv4 for some time, too, see the 'tso4' option of ifconfig(8). In the past weeks, Matthias Scheler and Yamamoto Takashi have worked on adding support for TCP/IPv6 TSO and the wm(4) driver, and the code is now available in NetBSD-current, it can be enabled via the 'tso6' option of ifconfig(8).

According to measurements by Matthias, load on the host CPU was reduced from ~16% to ~12%, while throughput went up at the same time from ~710MBit/s to ~806MBit/s. For comparison: TSO for IPv4 bumps the throughput from ~624MBit/s to ~713MBit/s.

[Tags: , , ]



[20061101] EtherIP driver
Hans 'woodstock' Rosenfeld has reworked the current EtherIP driver for NetBSD 4.0 based on tap(4) and gif(4), citing from the manpage: ``The etherip interface is a tunneling pseudo device for ethernet frames. It can tunnel ethernet traffic over IPv4 and IPv6 using the EtherIP protocol specified in RFC 3378.

The only difference between an etherip interface and a real ethernet interface is that there is an IP tunnel instead of a wire. Therefore, to use etherip the administrator must first create the interface and then configure protocol and addresses used for the outer header. This can be done by using ifconfig(8) create and tunnel subcommands, or SIOCIFCREATE and SIOCSLIFPHYADDR ioctls.''

See Hans' posting to tech-net for more details and a link to the code.

[Tags: , , ]



[20060829] Catching up
There were a number of interesting items in the past week or so that I didn't manage to put here so far. Instead of putting them into seperate entries, I'll take the liberty to assemble them into one entry here:

  • The Newsforge article "Which distro should I choose?" refers us to a Comparison between NetBSD and OpenBSD, the website apparently allows other comparisons.

  • Parallels is a ``powerful, easy to use, cost effective desktop virtualization solution that empowers PC users with the ability to create completely networked, fully portable, entirely independent virtual machines on a single physical machine.'' In other words "something like VMware". In contrast to the leading(?) product in that area, Parallels supports NetBSD as guest OS officially.

  • PC-98 is a PC-like computer from NEC that has a Intel CPU and that was only sold in Japan. Due to some subtle differences from the "original" (IBMesque) PC architecture, it can't run NetBSD/i386 and was so far supported e.g. by FreeBSD/PC98. Now, Kiyohara Takashi has made patches and a floppy image available for a NetBSD/pc98 port - see Kiyohara's mail to tech-kern for more details, and also some discussion about further abstraction of the current x86 architecture to support machines with Intel CPUs that can't run NetBSD/i386.

  • Staying on the technical side, David Young has a need to tunnel packets through consumer-grade (and consumer-intelligence) devices, which are unlikely to cope with anything outside of the IP protocol. As such, he has posted patches to tunnel gre(4) over UDP.

    Now let's hope this works as a foundation for Teredo (tunneling IPv6 over UDP)... :-)

  • Verified Exec is a security subsystem inside NetBSD that verified fingerprints of binaries before loading them. This prevents binaries from being changed unnoticed, e.g. by trojan horses. Now when NetBSD runs such a system and memory becomes tight, only the process' data is paged to disk, the executables text is simply discarded with the assumption that it can be paged in from the disk again when needed. Of course this assumes that the binary won't change, which may not be true in a networked scenario with NFS or a disk on a fiber channel SAN that may be beyond control of the local system administrator. To prevent attacks of this kind, Brett Lymn has worked to generate per-page fingerprints that are kept in memory even when the executable pages are freed, for later verification when they are paged in from storage again.

    The code is currently under review and available as a patch set - see Brett's mail to tech-kern for all the details!

  • While talking about security subsystems, Elad Efrat, who also worked on veriexec previously continued his work to factor out authentication inside the kernel: After introducing the kauth(9) framework and replacing all manual checks for "am I running as root" or "does the current secure level allow this operating" with calls to it, the next step is to seperate the the place where those calls are made from a back-end implementation that will determine what is allowed and what is not, who is privileged and what is not, etc. While these questions are traditionally answered via special user ids (0, root), group membership or secure levels, other methods like capability databases could be imagined.

    Elad has been working along these lines, and he has posted the next step in his work, outlining the upcoming security model abstraction - see Elad's mail to tech-security for details & code references.

  • NetBSD 3.1 is around the corner, which will be an update to NetBSD 3.0 with lots of bugfixes and some minor feature enhancements like new drivers and also support for Xen 3 DomainU. There's a NetBSD 3.1 Release Candidate 1 available - be sure to have a look!

  • FWIW, I've also updated the overview of NetBSD release branches a few days ago, as I still see a lot of people that are confused over NetBSD's three lines of release branches (well, counting the development branch NetBSD-current as release branch :), and the differences between what a branch and what a release is. With NetBSD 3.0, 3.0.1 and 3.1 this sure makes my little head spin...

  • But there's more than NetBSD 3.x! If you've watched the above link, you will understand that the next release after the NetBSD 3.x set of releases is NetBSD 4.x. The release cycle for NetBSD 4.0 has started a few days ago, and there's also an announcement about the start of the NetBSD 4.0 release process by the NetBSD 4.0 release engineer Jef Rizzo which has information on schedule, how YOU can help and getting beta binaries and sources.

  • The working period of the Google Summer of Code is over, and while mentors are still evaluating the code submitted by students, there are some public status reports: Alwe MainD'argent about the status of the 'ipsec6' project and Sumantra Kundu about the 'congest' project

  • Sysjail 1.0 has been released! Includes some interesting overhead benchmarks.

  • As reported in the #NetBSD Community Blog, an alpha version of sBSD was released: It's a NetBSD-based system for easy installation on USB sticks and CF cards.

So much for now. Enjoy!

[Tags: , , , , , , , , , , , , , ]


[20060509] Using WPA
Someone asked about how to use WPA, and before searching the docs and mailing lists again, this link may come in handy next time.

[Tags: , , ]


[20060131] NetBSD thanks WIDE and KAME for IPv6 implementation
As a reaction of KAME's conclusion, official mail to thank WIDE and KAME for the fine IPv6 implementation were sent out to them, see the copy sent to tech-net@. I can't say I wasn't involved in this mail... :-)

[Tags: , , ]


[20060131] Article: Special Report on the Conclusion of KAME
ipv6style.jp, an IPv6 portal site, has just released some articles regarding the conclusion of the KAME project, including an interview with Professor Jun Murai, history of the KAME project and comments from KAME "core" members.

[Tags: , , , ]


[20060126] OpenBGPd 3.7
OpenBGPd is an exterior routing daemon who speaks the Border Gateway Protocol. Thomas 'TGEN' Spanjaard has ported it to NetBSD, including support for TCP MD5 and signatures. See his mail to tech-net for a lot more details.

[Tags: , , ]


[20060126] nVidia nForce ethernet support
NVidia is not exactly known for opening up specifications for their hardware, and besides their graphics cards, buyers of their network cards or mainboards with those cards onboard have a problem. Support for NVidia's nForce ethernet controllers as e.g. found in some "Shuttle" computers was a problem for a long time, but it seems progress is finally there via the pkgsrc/sysutils/nvnet package. It's still only available as external driver via a LKM, but at least that's better than nothing. A success report with dmesg output is also available.

Of course having full specs to write a proper driver would be ways preferred over this.

[Tags: , , , , ]



[20060114] NetBSD's ftp and ftpd on Cray's UNICOS/mp
From the "of course it runs (parts of) NetBSD"-department: Scott Telford wrote me that Cray used NetBSD's ftp(1) client and ftpd(8) server for their UNICOS/mp 3.0 operating system, which is Cray's UNIX for the X1 and X1E supercomputers, based on IRIX 6.5. The UNICOS/mp Release Overview (dated March 2005) available in HTML and PDF, their ftp(1) manpage ftpd(8) manpage all mention this.

Further references to NetBSD can be found by searching for "NetBSD" on the Cray documentation archive. Their vfork(2) manpage refers to NetBSD's documentation on why to implement traditional vfork() in context of 4.4BSD's changes, which I find interesting in historical context.

[Tags: , , , , , ]



[20060107] Fighting ssh password guessing attempts (Update #2)
If you've looked in your /var/log/authlog recently, it's likely that you seem something like:
 Dec 11 09:21:50 xxx sshd[15335]: Failed password for root from 220.[...]
 Dec 11 09:21:53 xxx sshd[2720]: Failed password for root from 220.13[...]
 Dec 11 09:21:56 xxx sshd[7260]: Failed password for root from 220.13[...]
 Dec 11 09:22:28 xxx sshd[1762]: Illegal user enterprise from 220.135[...]
 Dec 11 09:22:31 xxx sshd[20415]: Illegal user release from 220.135.88.151
 Dec 11 09:22:34 xxx sshd[2405]: Illegal user release from 220.135.88.151
 Dec 11 09:22:37 xxx sshd[27329]: Illegal user release from 220.135.88.151
 Dec 11 09:22:40 xxx sshd[22310]: Illegal user release from 220.135.88.151 
While I know that NetBSD will withstand those annoying attempts as long as accounts are protected by good passwords (or even better, SSH keys), I sometimes wish to lock out people doing those attempts.

And there's help, in the form of a blog article (found via the #NetBSD Community Blog) describing how to use pop-before-smtp and IPfilter to firewall those people into eternity. (As far as I understand, the pop-before-smtp thing is mostly used to emulate 'tail -f', so I dare saying the meat of that article could be rewritten to only use tools that come with NetBSD. Any takers? Send URL! :)

Update: Ian Spray has taken the challenge and made a version that only uses tools that come with NetBSD. See his blog entry!

Update #2: Geert also brought this variant to my attention, which convers IPFilter, PF and IPFW (For FreeBSD, obviously). He found it in the BSDWiki.

[Tags: , , , ]



[20051206] Patch: an(4) radiotap for NetBSD 3.0 (Update #1)
Eric Auge has privided a patch against the an(4) driver for Aironet 4500/4800 and Cisco 340/350 series wireless network drivers in the upcoming NetBSD 3.0 release (available today on the netbsd-3 branch ans via some release candidates), allowing it to capture tcpdump(8) packets including their IEEE 802.11 headers. The patch also includes support for newer firmwares. See his mail for more information and a link to his patch.

Update #1: Eric has updated me that ``radiotap gives informations about the state of the card at the time the packet was received, the best example for that is using radiotap headers to have signal/noise informations without each time asking the card (using ioctl()).

With radiotap header the signal informations for this packet are embedded in those headers, same for channel informations, malformed packet flags, other flags or infos the card can provide directly within the driver (usually not accessible from userland) etc..''

For more data, see the ieee80211_radiotap(9) manpage (on -current, maybe 3.0 - I'm happy with 2.1 on my laptop!)

[Tags: , , ]



[20051119] How to run OpenBGPD on FreeBSD/NetBSD
I read a comment about running openbgpd on NetBSD, and wondered if there was any chance to do it. ISTR that it relied on a number of kernel features from a previous talk I've heared, but at least according to this "How to run OpenBGPD on FreeBSD/NetBSD" page it seems pretty straight forward and userland only. Has anyone actually tried this on NetBSD? Feedback welcome!

[Tags: , , ]


[20051007] The TCP/IP Drinking Game
Now that's a useful one for all of us: ``Find contestants and drinks. (An audience is optional.) Pass the cards around the circle. Each person asks a question of the person next in line. If that person can't answer, they drink to punish themselves. If they can answer, they drink to celebrate. If it was a particularly funny question, everyone drinks. Rifle through the stack of cards if you think the question on top isn't just right for the person you're asking.''. For the questions, check the website!

[Tags: , ]


[20051003] NetBSD/xen network backend improvements
Manuel Bouyer has committed a change to the Xen network backend and frontend, ``which reduce the number of hypercalls and interrupts, and avoids some unneeded copy when packets are sent/received.'' His mail shows more information, including numbers before and after his change, as well as instructions on how to get the most throughput out of the system.

[Tags: , ]


[20050810] Calculating IPv6 checksums in hardware
Yamamoto Takeshi has proposed a patch to calculate IPv6 checksums in hardware if the hardware can do so. Pretty nice to see to not only see this for IPv4 (which is available for quite some time), but also for the better IP protocol. :)

(While there, someone asked about reverse resolving of 6to4 address space the other day... if that is of interest to you check out https://6to4.nro.net/)

[Tags: , ]



[20050801] Multiplexing TCP services: inetd's tcpmux (Updated)
Have you ever used inetd's built-in tcpmux service? Neither have I, but after someone asked about it on #NetBSD today, I thought to give it a try. After not understanding the manpage on first read, it seems it's a re-invention of rpcbind (or vice versa), where you can create a TCP connection to the tcpmux port (1/tcp), and ask for a connection to a service to which you get connected then, by only knowing a service name, no port number needed.

Here's an example:

 (a) --> miyu# egrep '^(tcpmux|ftp)' /etc/inetd.conf 
         ftp             stream  tcp     nowait  root    /usr/libexec/ftpd       ftpd -ll
         tcpmux          stream  tcp     nowait  root    internal
 (b) --> miyu# telnet localhost 1
         Trying 127.0.0.1...
         Connected to localhost.
         Escape character is '^]'.
 (c) --> ftp
 (d) --> -Service not available
         Connection closed by foreign host.
 (e) --> miyu# egrep ^ftp /etc/inetd.conf | sed 's,^,tcpmux/,' >>/etc/inetd.conf
 (f) --> miyu# egrep '^ftp' /etc/inetd.conf
         ftp             stream  tcp     nowait  root    /usr/libexec/ftpd       ftpd -ll
         tcpmux          stream  tcp     nowait  root    internal
         tcpmux/ftp      stream  tcp     nowait  root    /usr/libexec/ftpd       ftpd -ll
         miyu# alias hup 
         kill -1 `cat /var/run/!*.pid`
 (g) --> miyu# hup inetd
 (h) --> miyu# telnet localhost 1
         Trying 127.0.0.1...
         Connected to localhost.
         Escape character is '^]'.
 (i) --> ftp
 (j) --> 220-
         220 localhost FTP server (NetBSD-ftpd 20050303) ready.
 (k) --> ^]
         telnet> quit
         Connection closed.
         miyu# 
The example first checks that the FTP and TCPMUX service are enabled in inetd.conf (a), then connects to the local tcpmux port (b) to ask for a connection to the "ftp" service (c), which is not available (d). Now after reading the inetd(8) manpage five times, duplicate the "ftp" line and prefix it with "tcpmux/" (e), and check that it got added to inetd.conf (f). Make sure that inetd reads in the changed config file (g). When connecting now (h) and asking for the "ftp" service (i), the ftp daemon is started and prints its banner (j).

As I don't really feel like speaking FTP without a client, I disconnect (k) and exit telnet.

So, the tcpmux service seems quite a nice tool which could be used to obsolete assigning ports in favour of service names. The problem is that no TCP service that I've stumbled across ever uses this nice mechanism. Even more strange, I wonder why things like rpcbind/portmap were invented in the presence of that serivce (and I guess that tcpmux does predate rpcbind etc.).

To play a bit more, I built myself a "cookie" service, adding this to /etc/inetd.conf:

tcpmux/cookie   stream  tcp     nowait  root    /usr/games/fortune fortune
Now I can run:
      miyu# echo cookie | nc localhost 1
      'Home, Sweet Home' must surely have been written by a bachelor.
      miyu# 

Who needs port numbers when you can request a service like this easily. :-) After reading RFC 1078, I even found that the protocol could safe one portscanning a machine to find out the services it runs:

      miyu# echo HELP | nc localhost 1
      +Available services:
      help
      cookie
      ftp
      miyu# 

And for the problem of having multiple versions of the same service running (which rpcbind addresses), RFC 1078 has a suggestion, too: ``Multiple versions of a protocol can suffix the service name with a protocol version number. ''. Easy, huh?

Looking into portmap and friends, Appendix A of RFC 1047 says that ``The port mapper program maps RPC program and version numbers to transport-specific port numbers. This program makes dynamic binding of remote programs possible.''. I.e. reasons for existance of rpcbind etc. are that that rpcbind does which are not easily achievable with the inetd/tcpmux combination: dynamic registration of services, transport over UDP and handling of broadcast requests.


P.S.: Try running fortune(6) without argv[0] being set. :-)


Update: Aparently the tcpmux service is actualy being used by Irix 6.5. Martin Neitzel sent me the inetd.conf of such a machine:

 % grep tcpmux irix65_inetd.conf
 tcpmux  stream  tcp     nowait  root    internal
 tcpmux/sgi_scanner stream tcp nowait root   ?/usr/lib/scan/net/scannerd scannerd
 tcpmux/sgi_printer stream tcp nowait root   ?/usr/lib/print/printerd printerd
 tcpmux/sgi_sysadm stream tcp nowait root   ?/usr/sysadm/bin/sysadmd sysadmd
 tcpmux/sgi_dmusrcmd stream tcp nowait root ?/usr/etc/dmusrcmd /usr/etc/dmusrcmd 


[Tags: , ]


[20050614] NDIS on NetBSD
iMil, of pkg_select fame, has started working on port of FreeBSD's "Project Evil" (:-) NDIS wrapper to NetBSD. Seems that he already was joined by another interested hacker, so maybe we can make use of a few more drivers soon. See his posting and his project page.

[Tags: , ]


[20050601] TCP Eifel patches up for testing
Kentaro A. Kurahone who has done previous optimisations of the NetBSD TCP/IP stack has made a patch for TCP Eifel available. The algorighm documented in RFCs 3522 and 4015 may help esp. users of slow links like GPRS, modem or heavily meshed wireless networks. Report your experiences on tech-net@!

[Tags: , ]


[20050519] NetBSD, TCP and validating segments before updating timestamps
I've looked a bit whether NetBSD is vulnerable to the security issue where a mallicious packet can update an internal timer value to a very high value, and thus obsoleting any later arriving (legal) packets. Looking at the middle of a series of commits in January 2005, it seems NetBSD is not vulnerable. (On the funny side, others call this vulnerability an "edge condition" - Hi Henning! :)

[Tags: , ]


[20050517] Playing with PXE - netbooting NetBSD
I always wanted to play a bit with PXE, and I finally borrowed my SO's laptop to do so. I found setting up a PC to netboot NetBSD via PXE pretty trivial with the instructions available. It's really just:

  1. setup tftp, dhcpd and nfs servers
  2. have proper DHCP setup, i.e. include something like this in dhcpd.conf:
     	host pxehost {
     	  hardware ethernet 01:23:45:67:89:ab;    # MAC address of PXE host 
     	  fixed-address 192.168.17.42;            # IP address of PXE host
     	
     	  # stage 1:
     	  filename "pxeboot_ia32.bin";            # relative to /tftpboot
     	
     	  # stage 2:
     	  next-server 192.168.42.1;               # IP of NFS server
     	  option root-path "/nfsroot";            # path on NFS server
     	}

  3. copy pxeboot binary from /usr/mdec to /tftpboot (for boot stage 1)
  4. setup and export root filesystem via NFS (/nfsroot, for stage 2)
  5. tell PC to use PXE
The PC will then issue a DHCP request from which it knows which pxeboot binary to load (via tftp, stage 1), and that binary will then go and load a NetBSD kernel from NFS (stage 2). The NetBSD kernel in turn mounts the root filesystem via NFS, too, and starts /etc/rc as usual.

[Tags: , , ]


[20050428] NetBSD: Live disk backup
der Mouse has developed a system to intercept block read/write operations in disk drivers (wd, sd) in realtime, and mirror them over a network to a remote process which will then write the blocks back to disk. Regardless of the filesystem used, this will allow a live backup of a "hot" disk, and if data rate gets too high to transfer blocks (as disks are a bit faster than networks today ;), the system will fall back to making a list of blocks that need backup, and will process them when system load's down again later.

The code is already available for NetBSD 2.0 (and 1.4T, for those still running it 8-), and der Mouse will also present the system at BSDCan 2005. (Pity I didn't have time to accept the invitation when I asked to come to BSDCan :(). Anyways, see the README file to get more information!

[Tags: , ]



[20050428] IP over snails
Faster than DSL, and more reliable than IP over avian carrier (see RFCs 1149, 2322 and 2549): IP over snails.

[Tags: ]


[20050425] NForce ethernet driver
William S. Morgart has ported Quinton Dolan's FreeBSD i386 port of the NVidia NForce ethernet driver to NetBSD. The driver seems to make use of the NVidia Linux sources. See William's posting for all the details!

[Tags: , , , ]


[20050319] IEEE 802.3ad Link Aggregation
Yamamoto Takashi has committed code to NetBSD to allow IEEE 802.3ad link aggregation (also known as "channel bonding"). For more information, see the manpage or this webpage.

[Tags: ]


[20050317] NetBSD's TCP/IP stack used by QNX
Following up the discussion of Sony using NetBSD's network stack in the PSP, it was pointed out that QNX also uses NetBSD's TCP/IP stack for its features like IPsec and IPv6. It's mentioned in several documents on the QNX website.

[Tags: , , ]


[20050312] IPF: The IP Filter
This introduction discusses IPfilter. Setup is described for FreeBSD, but that shouldn't be much of a difference on NetBSD (see... um, where's our generic firewalling documentation?). The text discusses what a firewall is, basic and more advanced filtering like on interface or on IPs and advanced topics like defaulting to deny (beware to not lock traffic to lo0 :), keeping state and IPv6.

[Tags: , , ]


[20050311] Using ALTQ with NetBSD
Miles Nordin has posted a rather detailled answer on how to setup ALTQ on a question on how to use ALTQ. Very nice, there seems to be a lack of introductory documentation on ALTQ.

[Tags: , ]


[20050302] Patches: direct I/O and link-local IPv4 addresses
From the work-in-progress department: Chuck Silvers has posted first patches for direct I/O, to allow applications which want to circumvent the buffer cache and do their own buffering -- like databases -- to do so. See the tech-kern archives for more information, or check information how RedHat does it.

On another front, the IETF Zeroconf working group has introduced "link-local" IPv4 addresses which are similar to IPv6 link-local addresses, but only intended if there are no other addresses available, e.g. in unconnected home networks. The draft also states explicitly that it ``does not recommend that IPv4 Link-Local addresses and routable addresses be configured simultaneously on the same interface''. David Young has posted a patch that implements these link-local IPv4 addresses on NetBSD. So if you're too lazy to manage IP numbers on your unconnected home network, check this out. Or try IPv6. :)

[Tags: ]



[20041025] Drivers for Prism-54 WaveLAN
Those in desperate need of a driver for their Prism-54 card can have a look at this page... includes some funny examples on how to access ieee802.11-ioctls from Ruby (*.rb files).

[Tags: , , ]


[20041017] NetBSD Drivers for Intel Centrino
So I didn't notice Damien Bergamini has written drivers for the Intel PRO/Wireless 2100 and Intel PRO/Wireless 2200BG/2915ABG cards, one of them has even be moved into -current some time ago (but is only mentioned in the GENERIC_LAPTOP file, not GENERIC). See Damien's page for more information!

[Tags: , , , ]


[20040930] Internet 2 Landspeed Record: Ooops, they did it again!
Aparently the folks from the Swedish University Network (SUNet) at Lulea managed to break their previous Internet 2 Landspeed record for both single and multiple streams, using NetBSD again. Comparison:
Old record:
  • 838860800000 bytes in 1588 real seconds = 4226 Mbit/sec o
  • Distance: 16,343 km (10,157 miles)
  • 69.073 Petabit-meters/second (12% increase)

New record:
  • 1966080000000 bytes in 3648.81 real seconds = 4310.62 Mbit/sec
  • Distance: 28,983 km (18,013 miles)
  • 124.935 Petabit-meters/second (78.6% increase)
The big difference in distance and thus the record itself is due to suboptimal routing, crossing the ocean three times. Nonetheless, thanks to a newer version of end machines' operating system -- a prerelease of NetBSD 2.0 -- and some newer routers, this record was achieved on a production network just in the previous case. See the project pages for single stream and multiple streams for more information!

[Tags: , , ]


[20040819] More ath adventures - NetBSD >> Linux
I continued playing with the Atheros 54MBit WaveLAN cards and an LanCom Access point today. Getting things configured in NetBSD was all easy, simply setting "mediaopt turbo" as listed by "ifconfig -m ath0" and the channel that the AP was tuned to, and off we went. Almost - I first had to find out that setting the countrycode to Germany (by patching CTRY_DEFAULT=276 into the kernel) didn't give any Turbo modes from the HAL, so we operated the hardware in US frequency bands. Getting the card to attach to the WaveLAN and tune into the right frequency, ping the access point in the Atheros Turbo mode was all no problem. On NetBSD.

On Linux, the MadWiFi driver patched into either a 2.4.x or 2.6.x kernel didn't work when enabling Turbo mode, giving obscure error messages that we could decode as wrong parameters to one of the HAL functions by the ifconfig(!) command. This and all the maze of various tools like ifconfig, iwconfig, iwpriv together with the lot of undocumented arguments you had to hand them didn't help to make setting up Turbo mode on an Atheros card w/ Linux a straight forward job. Manpages for these tools? You wish! And if available, they're uncomplete and tell the important bits that you have to put into the "private" bits of the card.

Today's experience confirmed that if you want a working setup with little to no fuzz, NetBSD is the right choice! Of course in an economy that lives from consulting and broken things, Linux sounds much better as it will create demand for support, consulting and fixing where things could just work, and people could just get work done otherwise. Oh well!

Performance measurements with iperf showed 43MBit/s (~5MByte/s) between a Pentium-133 running Linux connected to the AP via ethernet, and a PIII-800 running NetBSD 2.0_BETA/i386 and a -current kernel from today.

[Tags: , , , , ]



[20040819] Playing with an ath card
A friend of mine is testing some Linux WiFi stuff at the local University's Computing Center, and we went to try out NetBSD with an Atheros card today. An experience made was that the card isn't easily set to the german frequency modes, even though there is a sysctl present for it. The solution was to make sure that CTRY_DEFAULT gets initialized to 276 in contrib/sys/dev/ic/athhal.h. Now unfortunately no "turbo" modes are available in -current as of today, while 2.0_BETA finds and lists them both in "dmesg" and "ifconfig -m". Doh!

[Tags: , , ]


[20040801] Driver for Intel PRO/Wireless 2100 (Centrino)
Damien Gergamini has announced a native NetBSD driver for the Intel(R) PRO/Wireless 2100 802.11b network adapter (a core component of the Intel(R) Centrino technology). See his posting or go directly to his site.

Note that the driver is based on on NeTBSD 1.6.2, but updates for the upcoming NetBSD 2.0 release won't be away far.

[Tags: , , , ]



[20040623] PF in NetBSD-current now!
Itojun has imported the PF firewalling software into NetBSD-current. Users now have a choice between IPfilter and PF. More information on PF can be found e.g. on the PF homepage.

[Tags: , , ]


[20040621] SiNic: Running NetBSD on a WiFi PC Card
Seclarity's SiNic Wireless card looks like other wireless LAN cards but is actually a fully-contained, standalone Unix computer running NetBSD. It can do 802.11 wavelan as well as many other fine things. Check out the PC World article.

[Tags: , , , ]


Previous 3 entries

Tags: , 2bsd, 3com, 501c3, 64bit, acl, acls, acm, acorn, acpi, acpitz, adobe, Advocacy, advocacy, advogato, aes, afs, aiglx, aio, airport, alereon, alex, alix, alpha, altq, am64t, amazon, amd64, anatomy, ansible, apache, apm, apple, arkeia, arla, arm, art, Article, Articles, ascii, asiabsdcon, asterisk, asus, atf, ath, atheros, atmel, audio, audiocodes, autoconf, avocent, avr32, aws, axigen, backup, banners, basename, bash, bc, benchmark, bigip, bind, blackmouse, bldgblog, blog, blogs, blosxom, bluetooth, bonjour, books, boot, boot-z, bootprops, bozohttpd, bs2000, bsd, bsdca, bsdcan, bsdcertification, bsdcg, bsdforen, bsdfreak, bsdmac, bsdmagazine, bsdnexus, bsdstats, bsdtalk, bsdtracker, bug, build.sh, busybox, buttons, bzip, c-jump, c99, cafepress, callweaver, camera, candy, capabilities, card, carp, cars, cauldron, ccc, ccd, cd, cddl, cdrom, cdrtools, cebit, centrino, cephes, cert, certification, cfs, cgd, cgf, checkpointing, china, cisco, cloud, clt, cobalt, coccinelle, codian, colossus, common-criteria, community, compat, compiz, compsci, concept04, config, console, contest, copyright, core, cortina, coverity, cpu, cradlepoint, cray, crosscompile, crunchgen, cryptography, csh, cu, cuneiform, curses, curtain, cuwin, cvs, cvs-digest, cvsup, cygwin, daemon, daemonforums, danger, darwin, data, date, dd, debian, debugging, dell, desktop, devd, devfs, devotionalia, df, dfd_keeper, dhcp, dhcpcd, dhcpd, dhs, diezeit, digest, digests, dilbert, dirhash, disklabel, distcc, dmesg, Docs, donations, draco, dracopkg, dragonflybsd, dreamcast, dri, driver, drivers, drm, dsl, dst, dtrace, dvb, ec2, eclipse, eeepc, eeepca, ehci, ehsm, eifel, elf, em64t, Embedded, embedded, emips, emulate, encoding, envsys, eol, espresso, etcupdate, etherip, euca2ools, eucalyptus, eurobsdcon, eurosys, Events, exascale, ext3, f5, facebook, falken, fan, fatbinary, features, fefe, ffs, filesystem, fileysstem, firefox, firewire, fireworks, flag, flash, flashsucks, flickr, flyer, fmslabs, force10, fortunes, fosdem, fpga, freebsd, freedarwin, freescale, freex, freshbsd, friendlyAam, friendlyarm, fritzbox, froscamp, fsck, fss, fstat, ftp, ftpd, fujitsu, fun, fundraising, funds, funny, fuse, fusion, g4u, g5, galaxy, games, gcc, gdb, gentoo, geode, getty, gimstix, git, gnome, google, google-soc, gpio, gpl, gprs, gracetech, gre, groff, groupwise, growfs, grub, gumstix, guug, gzip, hackathon, hackbench, hal, hanoi, happabsd, Hardware, haze, hdaudio, heat, heimdal, hf6to4, hfblog, hfs, history, hosting, hp, hp700, hpcarm, hpcsh, hpux, html, httpd, hubertf, hurd, i18n, i386, i386pkg, ia64, ian, ibm, ids, ieee, ifwatchd, igd, iij, image, images, information, init, initrd, install, intel, interix, internet2, io, ioccc, iostat, ipbt, ipfilter, ipmi, ipsec, ipv6, irbsd, irc, irix, iscsi, isdn, iso, isp, itojun, jail, jails, java, javascript, jibbed, jihbed, jobs, jokes, journaling, kame, kauth, kde, kerberos, kergis, kernel, keyboardcolemak, kitt, kmod, kolab, kylin, l10n, landisk, laptop, laptops, law, ld.so, ldap, lehmanns, lenovo, lfs, libc, license, licensing, links, linksys, linux, linuxtag, live-cd, lkm, localtime, locate.updatedb, logfile, logging, logo, logos, lom, lte, lvm, m68k, macmini, macppc, macromedia, magicmouse, mahesha, mail, makefs, malo, mame, manpages, marvell, matlab, maus, mbr95, mbuf, mca, mdns, mediant, mediapack, meetbsd, mercurial, mesh, meshcube, mfs, mhonarc, microkernel, microsoft, midi, mini2440, miniroot, minix, mips, mirbsd, missile, mit, mobile-ip, modula3, modules, mouse, mp3, mpls, mtftp, mult, multics, multilib, multimedia, music, mysql, named, nas, nat, ncode, ndis, nec, nemo, neo1973, netbook, netboot, netbsd, netbsd.se, nethack, nethence, netksb, netstat, networking, neutrino, nforce, nfs, nis, npf, npwr, nroff, nslu2, nspluginwrapper, ntfs-3f, nullfs, numa, nvi, nvidia, nycbsdcon, office, ofppc, ohloh, olimex, olpc, onetbsd, openat, openbgpd, openblocks, openbsd, opencrypto, opengrok, openmoko, openoffice, openpam, opensolaris, openssl, oracle, oreilly, oscon, osf1, osjb, packages, pad, pae, pam, pan, panasonic, parallels, pascal, patch, patents, pax, paypal, pc532, pc98, pcc, pci, pdf, pegasos, penguin, performance, pexpect, pf, pfsync, pgx32, php, pike, pinderkent, pkg_install, pkg_select, pkgin, pkglint, pkgmanager, pkgsrc, pkgsrc.se, pkgsrcCon, pkgsrccon, plathome, pocketsan, podcast, pofacs, politics, polls, polybsd, portability, posix, postinstall, power3, powernow, powerpc, powerpf, pppoe, precedence, preemption, prep, presentations, prezi, Products, products, proplib, protectdrive, proxy, ps, ps3, psp, pthread, ptp, ptyfs, Publications, puffs, pxe, qemu, qnx, qos, qt, quality-management, quine, quote, quotes, r-project, radio, radiotap, raid, raidframe, rants, raptor, raq, raspberrypi, rc.d, readahead, realtime, record, refuse, reiserfs, Release, releases, releng, reports, resize, restore, ricoh, rijndael, rip, riscos, rng, roadmap, robopkg, robot, robots, roff, rootserver, rotfl, rox, rs6k, rss, ruby, rump, rzip, sa, safenet, san, savin, sbsd, scampi, scheduling, sco, screen, script, sdf, sdtemp, secmodel, Security, security, sed, segvguard, seil, sendmail, sfu, sge, sgi, sgimips, sh, sha2, shark, sharp, shisa, shutdown, sidekick, size, slackware, slashdot, slit, smbus, smp, sockstat, soekris, softdep, software, solaris, sony, source, source-changes, spanish, sparc, sparc64, spider, spreadshirt, squid, ssh, sshfs, ssp, stereostream, stickers, studybsd, subfile, sudbury, sudo, summit, sun, sun2, sun3, sunfire, sunpci, support, sus, suse, sushi, susv3, svn, swcrypto, symlinks, sysbench, sysinst, sysjail, syslog, syspkg, systat, systrace, sysupdate, t-shirt, tabs, tanenbaum, tape, tcp, tcp/ip, tcpdrop, tcpmux, tcsh, teamasa, teredo, termcap, terminfo, testdrive, testing, tetris, tex, TeXlive, thecus, theopengroup, thin-client, thinkgeek, thorpej, threads, time, time_t, timecounters, tip, tme, tmp, tmpfs, tnf, toaster, todo, toolchain, top, torvalds, toshiba, touchpanel, training, tso, ttyrec, tulip, tun, tuning, uboot, udf, ufs, ukfs, ums, unetbootin, unicos, unix, updating, upnp, uptime, usb, usenix, useradd, userconf, userfriendly, usermode, usl, utc, utf8, uucp, uvc, uvm, valgrind, vax, vcfe, vcr, veriexec, vesa, video, videos, virtex, vm, vmware, vnd, vobb, voip, voltalinux, vpn, vpnc, vulab, w-zero3, wallpaper, wapbl, wargames, wasabi, webcam, webfwlog, wedges, wgt624v3, wiki, willcom, wimax, window, windows, winmodem, wireless, wizd, wlan, wordle, wpa, wscons, wstablet, x.org, x11, x2apic, xbox, xcast, xen, xfree, xfs, xgalaxy, xilinx, xkcd, xlockmore, xmms, xmp, xorg, xscale, youos, youtube, zaurus, zdump, zfs, zlib

'nuff. Grab the RSS-feed, index, or go back to my regular NetBSD page

Disclaimer: All opinion expressed here is purely my own. No responsibility is taken for anything.

Access count: 14343040
Copyright (c) Hubert Feyrer