[NBLUG/talk] Networking newbie

Andrew argonaut at gmx.co.uk
Tue Jan 10 17:52:03 PST 2006


A'fish'ionado wrote on Tue, 10 Jan 2006 15:59:05 -0800:

> > ifconfig eth0 10.0.0.12 netmask 255.255.255.0 broadcast
> > 10.0.0.255
> 
> There we go. :-)
> 
> OK, I'm to the point where I have a network of two Debian
> boxes. I fire up the server, and it gets the address
> 10.0.0.255. ifup eth0 on the laptop registers it on the network
> as 10.0.0.200. Each box can ssh into itself on its address.
> 
> However, when I try to ssh into the opposite box, I fail.

OK. Let's see if we can't get you straightened out with something
more permanent. First, kudos and thanks to all who replied
before. I'm building on your comments.

Now, before we actually configure stuff, let's nail a few things
down, for your benefit, and/or the benfit of other readers:

Your network (let's make it a 256-node "Class C") will be
10.0.0.0. This refers to the *entire* network, as a whole, no
matter how many or few nodes (hosts) it contains. In your
dhcpd.conf, this is referred to as the subnet.

The netmask for this Class C network is 255.255.255.0. This means
that the first three octets (dot-delimited numbers) of each IP
address in the network will be the same. In your network, that
means all addresses will start with 10.0.0. Only the last number
will change from node to node.

The broadcast address for this network is 10.0.0.255. No
individual node can have this address. In fact, all nodes on the
network listen for packets sent to their own individual address
*and* for packets sent to the broadcast address. Sending a packet
to 10.0.0.255 is like shouting to all nodes on the network.

Since the broadcast address (ending in 255) is reserved for
"shouting" to all, and the network address (ending in 0) is
reserved for indicating the entire network (as sort of an
abstract concept, I guess), we are left with 254 valid IP
addresses in our Class C network. These are in the range 10.0.0.1
to 10.0.0.254, inclusive. For your DHCP server, you can choose to
use any or all of this range.

Right. Now let's get our hands dirty, starting with the DHCP
server. I've never configured dhcp3 before or even seen its
config so I'm going to have to assume the syntax you gave for
your config is almost correct. It should look like this:

subnet 10.0.0.0 netmask 255.255.255.000 {
        range 10.0.0.150 10.0.0.200;
}

As you can see, the range you chose to serve falls within the
range of all available IP addresses, so you're good there. Your
netmask is also fine (though I wonder about the necessity for all
three zeros). Only the subnet (aka "network", as defined above)
needed to be fixed. Others on this list already pointed this out,
so hopefully you've already made the change. If there are other
changes you need to make to the config, such as for DNS servers,
etc., you'll have to figure them out yourself.

Now, for the Ethernet interfaces. If you can access the Internet
or have your Debian install disks with you, this will be easy.
Just apt-get install etherconf. As it installs, it will ask you
questions about your network. For now, just choose for the
interface(s) to receive their configuration(s) from the DHCP
server. Do this on both the desktop and laptop. If, at any time,
you want to re-run the etherconf configuration, just run (as
root) "dpkg-reconfigure etherconf".

In the background, etherconf will write the interface
configuration to /etc/network/interfaces. If you can't (or don't
want to) install etherconf, you can edit this file by hand. It
should look something like this:

auto lo eth0

iface lo inet loopback

iface eth0 inet dhcp

The first line, "auto lo eth0", means "bring the lo and eth0
interfaces up automatically at boot time". The second line,
"iface lo inet loopback", configures the lo interface. It always
looks like this. The third line, "iface eth0 inet dhcp",
configures the eth0 interface to grab its configuration
information from the one and only DHCP server that should be
operating on that network. You can learn more about the
/etc/network/interfaces file by doing a "man 5 interfaces".

Now, you should have your DHCP server configured. Start or
restart it. Then bring the eth0 interface on the desktop (that's
where the DHCP server is, right?) down with "ifdown eth0" and
bring it up again with "ifup eth0". Do the same for the eth0
interface on the laptop. If all is well, each interface should
grab an IP address lease from the DHCP server.

Check with "ifconfig eth0" and ping.

Good luck. I'm off to the store and then the meeting.

A.



More information about the talk mailing list