Наши партнеры

Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Next: Writing hosts and networks Up: Configuring TCP/IP Networking Previous: Setting the Hostname

Assigning IP-Addresses

If you configure the networking software on your host for standalone operation (for instance, to be able to run the INN netnews software), you can safely skip this section, because you will need an IP-address just for the loopback interface, which is always

Things are a little more complicated with real networks like Ethernets. If you want to connect your host to an existing network, you have to ask its administrators to give you an IP-address on this network. When setting up the network all by yourself, you have to assign IP-addresses yourself as described below.

Hosts within a local network should usually share addresses from the same logical IP-network. Hence you have to assign an IP-network address. If you have several physical networks, you either have to assign them different network numbers, or use sub-netting to split your IP-address range into several subnetworks.

If your network is not connected to the Internet, you are free to choose any (legal) network address. You only have to make sure to choose one from classes A, B, or C, else things will most likely not work properly. However, if you intend to get on the Internet in the near future, you should obtain an official IP-address now. The best way to proceed is to ask your network service provider to help you. If you want to obtain a network number just in case you might get on the Internet someday, request a Network Address Application Form from hostmaster@internic.net.

To operate several Ethernets (or other networks, once a driver is available), you have to split your network into subnets. Note that sub-netting is required only if you have more than one broadcast network; point-to-point links don't count. For instance, if you have one Ethernet, and one or more SLIP links to the outside world, you don't need to subnet your network. The reason for this will be explained in chapter-gif.

As an example, the brewery's network manager applies to the NIC for a class B network number, and is given To accommodate the two Ethernets, she decides to use eight bits of the host part as additional subnet bits. This leaves another eight bits for the host part, allowing for 254 hosts on each of the subnets. She then assigns subnet number 1 to the brewery, and gives the winery number 2. Their respective network addresses are thus and The subnet mask is

vlager, which is the gateway between the two networks, is assigned a host number of 1 on both of them, which gives it the IP-addresses and, respectively. Figure-gif shows the two subnets, and the gateway.

Note that in this example I am using a class B network to keep things simple; a class C network would be more realistic. With the new networking code, sub-netting is not limited to byte boundaries, so even a class C network may be split into several subnets. For instance, you could use 2 bits of the host part for the netmask, giving you four possible subnets with 64 hosts on each.gif

Next: Writing hosts and networks Up: Configuring TCP/IP Networking Previous: Setting the Hostname

Andrew Anderson
Thu Mar 7 23:22:06 EST 1996