How to set up a cable modem using DHCP in FreeBSDHow to set up a cable modem in
FreeBSD
This applies to the broadband ISP Chello, but could be applicable to others.
Chello uses DHCP and assigns dynamic IP. This means that you don't have to do
much in ways of configuration.
FreeBSD uses a program called dhclient to communicate with the DHCP server. In
FreeBSD releases=>4.0, dhclient is a part of the base install, in /sbin. This,
and an option (mentioned later) in the kernel configuration, is all the software
you need.
Install the NIC in your computer. Connect cable modem to TV cable outlet, and
modem to NIC.
See that the card is recognized at boot-time. Use dmesg | less if necessary.
xl0: <3Com 3c900B-TPO Etherlink XL> port 0xdf80-0xdfff mem 0xffefff80-0xffefffff irq 9 at device 11.0 on pci0
xl0: Ethernet address: 00:50:da:e2:7d:b3
xl0: selecting 10baseT transceiver, half duplex
Recompile your kernel (refer to theFreeBSD handbook) with
a) support for your NIC enabled.[1] In the case of my card, 3Com 3c900, the
name of the device is xl. (Grep the file /usr/src/sys/i386/conf/LINT for the
name of your NIC) This means that I add (or uncomment) these lines to my
kernel configuration file, if they are not already there:
device miibus0 # MII bus support
device xl0 # 3Com 3c90x (``Boomerang'', ``Cyclone'')
b) the "Berkeley Packet filter pseudo-device":
# The `bpf' pseudo-device enables the Berkeley Packet Filter.
# Be aware of the administrative consequences of enabling this!
pseudo-device bpf 4 #Berkeley packet filter
[2]
Make and install new kernel. Reboot.
Make the bpf devices, like so:
cd /dev
sh MAKEDEV bpf0 bpf1 bpf2 bpf3
(This corresponds with 4 in the bpf line in the kernel file.)
run /stand/sysinstall. Choose Configure - Networking - Interfaces.
The first interface on the list should be your NIC. Select this. Answer "yes"
to "Bring interface xxx up now?". (This runs ifconfig xl0 up for you.)
Sysinstall writes the necessary changes to the file /etc/rc.conf, and on next
reboot, the card will be detected, and dhclient will be run, receive a IP from
your friendly DHCP server. dhclient needs a configuration file called
/etc/dhclient.conf, but in most cases, this can be left empty.
[1] The FreeBSD handbook contains a list over supported NICs. Note that
4.0-release had a bug in the ep device driver,and earlier 4.0-current snapshots
had a bug in the xl driver (in the file /usr/src/sys/pci/if_xl.c, to be precise)
which I found out the hard way. I have the diff to fix this file, if you should
be in my unfortunate position.
[2] LINT says this about mii
# "device miibus0" to the kernel config pulls in support for
# the generic miibus API and all of the PHY drivers, including a
# generic one for PHYs that aren't specifically handled by an
# individual driver.
Where to look for help if (when?) this fails
http://www.CableModemInfo.com
http://www.cable-modem.net
http://www.freebsddiary.org/athome.html
http://freebsd.simplenet.com/dhcp.html
http://www.freebsddiary.org/dhcp2.html
               (
geocities.com/hackermuda)