3. Configuration
3.1. Ready to Start With an Ethernet-Modem connection
Once you are plugged into the system, your modem is on and your dhcp server is running as outlined in Section 2.5, you should be provided your own IP address that doesn't change unless you drop the lease (i.e. are offline) for a while. To confirm that the DHCP client is working and you have a new IP address, execute (as root) ifconfig without any other arguments, and you should see the following:
eth0 Link encap:Ethernet HWaddr 00:D0:09:DE:D4:6F inet addr:66.190.XXX.XXX Bcast:255.255.255.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:2591777 errors:0 dropped:0 overruns:0 frame:0 TX packets:5589 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:168673636 (160.8 MiB) TX bytes:1752872 (1.6 MiB) Interrupt:12 Base address:0xc400 |
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:5168 errors:0 dropped:0 overruns:0 frame:0 TX packets:5168 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1695104 (1.6 MiB) TX bytes:1695104 (1.6 MiB) |
...which shows the system loopback device, lo, and also eth0, the cable modem having successfully acquired an IP address (the 'inet addr') provided by our cable internet service provider.
A simple Ethernet-based configuration should be complete at this step. If you have more than one Ethernet interface available and want to select a specific one for the cable service, go on to Section 3.2.
3.2. Grabbing A Specific Interface
Let's say we want to select a specific Ethernet interface (ethX) to be the recipient of the DHCP cable internet service. If you run ifconfig as root you get a list of open devices:
eth0 Link encap:Ethernet HWaddr 00:D0:09:DE:D4:6F inet addr:192.168.1.1 Bcast:192.168.1.255 Mask:255.255.255.0 BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) Interrupt:12 Base address:0xc400 |
lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:5168 errors:0 dropped:0 overruns:0 frame:0 TX packets:5168 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:1695104 (1.6 MiB) TX bytes:1695104 (1.6 MiB) |
...where eth0 is a standard NIC that we have preconfigured to the IP address 192.168.1.1.
Note the HWaddr field, or hardware address, on the first line. This is the same as the MAC, or Media Access Control address, and is how we will specify the interface for each action.
3.2.1. Manually Assigning MAC to Interface Name
Whatever distribution you use, you can always use the command line to designate an Ethernet device (via the MAC) to be interface 'ethX' with or without a particular IP address. This may be necessary when you change your settings, swap out hardware or for just plain testing. Use ifconfig:
# ifconfig ethX hw ether 00:D0:09:DE:D4:6F up |
You can check if it worked by calling ifconfig without options after your next reboot. See man ifconfig for more options.
3.2.2. Automatic Configuration of Devices
The method for automatically assigning a particular interface name ethX, to a specific hardware interface (Media Access Control address) differs by distribution.
3.2.2.1. Debian
If you are running a Debian system, you can alter the /etc/network/interfaces file to look like this:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8) # The loopback interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.1 netmask 255.255.255.0 network 192.168.1.0 hwaddress ether 00:D0:09:DE:D4:6F auto eth1 iface eth1 inet dhcp hwaddress ether 00:04:BD:DE:42:0B |
The auto eth0 and auto eth1 are required to have the interfaces configured at boot-up. Note that some versions of dhcp clients by default always grab eth0 for the dhcpc interface. So even after doing all the above, unless you specifically run /sbin/dhcpcd-bin eth1 it won't work. The easy way to do this at boot up is to make an init script to load the dhcp address to the correct interface, which should be placed in /etc/init.d. Then run update-rc.d as root with the correct arguments (see man update-rc.d).
3.2.2.2. Red Hat
The file to edit will of the form ifcfg-ethX, located in /etc/sysconfig/network-scripts/. The contents are typically of the form:
DEVICE=eth1 # Device name. This is the interface your cable modem will use. ONBOOT=yes # load at boot BOOTPROTO=dhcp # sets the device to receive an IP address from a DHCP server HWADDR=00:04:BD:DE:42:0B # the hardware MAC |
Edit the relevant sections with your favorite text editor program as root to reflect your interface name and MAC and save it. If the file doesn't exist for the interface you need you can create it, for example ifcfg-eth1. You can then use ifconfig eth1 up from the command line to use it immediately. Upon reboot the correct hardware settings should be loaded automatically.
3.2.2.3. Slackware
Slackware has a configuration utility named 'netconfig' that you can use at the command line as root to modify your network settings and configure interfaces by static IP addresses or dhcp. You can rerun it at any time to reconfigure things once you have installed your modem.
3.2.2.4. Other Distributions
Feel free to contribute if you have distribution-specific information to add; see Section 1.5. Consult your distribution documentation where appropriate.
3.3. Using the USB interface instead of an Ethernet card
3.3.1. USB CDCEther
If you wish to use the USB interface to accept data you will need USB subsystem support in your kernel as discussed in Section 2.1, whether USB-ohci, USB-ehci, or whatever USB host controller driver required by your system. For a more in-depth discussion of this, I direct you to the Linux-USB project site.
In addition the CDCEther (Communications Device Class Ethernet) protocol common to cable modems.
There are two ways your kernel may support a device driver: either by being statically (always on) compiled within that kernel or loaded (at boot time or later by a script or manually) as a module. You can find out if a driver is statically compiled in the kernel by checking the log of messages at boot up using dmesg | less on the command line. Experienced users may want to take an easier route and check the configuration file for the currently running kernel in /boot, usually of the form config-2.X.x, which is a text file that can be grepped. On the command line, try grep -e followed by CONFIG_USB_CDCETHER in 2.4.x kernels or CONFIG_USB_ETH in 2.6.x kernels followed by the filename; you should see a '=y or =m at the end of this string for static or modular status, respectively.
The output of dmesg | less should reveal something similar to the following
Mar 2 11:00:52 K7 kernel: CDCEther.c: 0.98.6 7 Jan 2002 Brad Hards and another Mar 2 11:00:52 K7 kernel: usb.c: registered new driver CDCEther |
in the case of a statically compiled driver or a module loaded at boot.
If you don't see it, to find out if your kernel has already loaded the CDCEther (Communications Device Class Ethernet) driver as a module, on the command line issue lsmod as root. You should see the module CDCEther listed for 2.4.x kernels, or alternatively usbnet for 2.6.x kernels.
If you don't see it listed with lsmod try loading the module directly as root; for kernel 2.4.x this would be of the form
# modprobe CDCEther |
# modprobe usbnet |
If all goes well you should see something like the following at the end of your system log files (/var/log/messages or /var/log/syslog, you may need to be root to view these) or at the end of dmesg | less from the command line:
Mar 2 11:00:52 K7 kernel: CDCEther.c: 0.98.6 7 Jan 2002 Brad Hards and another Mar 2 11:00:52 K7 kernel: usb.c: registered new driver CDCEther |
If all goes well you should see something like the following in your system log files or at the end of dmesg:
Mar 2 11:00:52 K7 kernel: CDCEther.c: 0.98.6 7 Jan 2002 Brad Hards and another Mar 2 11:00:52 K7 kernel: usb.c: registered new driver CDCEther |
If you are unsuccessful with any of the above, and are determined to use the USB conduit of this device, you will need to recompile your kernel to support it. You will need the 2.4.3 kernel or later. For detailed instructions on recompiling your kernel, I direct you to the Kernel-HOWTO. The options required to get USB interface support working on this device have been addressed in Section 2.1.