A Primer on IP Addressing, Subnetting, and Netmasks --------------------------------------------------- With the Internet Connectivity Option version 2.0, you can assign specific IP addresses to specific users so they can connect to your server with a SLIP, CSLIP, or PPP connection and run their own servers on the Internet. You can also support dynamic IP addresses for occasional users. None of this is necessary (and you don't need to bother with subnetting) if all your users want to have SLIP, CSLIP or PPP connections to run Netscape or other Internet-browsing packages. It *is* necessary to create subnets if any of your users need to put their own server computers on the Internet, or if anyone needs to run certain packages, such as the RealAudio Player, or an FTP client that only uses the PORT command (instead of the PASV command like Netscape uses). We'll start with some theory and then go through a specific example. IP Addressing ------------- TCP/IP addressing has some flexible ways of identifying networks, identifying hosts within a network, and creating new networks. IP addresses are composed of 32 bits or 4 bytes. For example: 199.227.15.14 Each of these four numbers (or bytes) can range from 0 to 255. IP addresses are also composed of two parts: Network part Identifies a network Host part Identifies a host computer within a network Some bits are reserved for the network part, the rest are for the host part. The standard partition between network bits and host bits works differently for different ranges of IP addresses, called classes. The three most important classes are A, B, and C. Approximate number of Number of hosts within Class IP address range networks each network ----- ---------------------------- -------- ------------ A 0.0.0.0 to 127.255.255.255 128 16 million B 128.0.0.0 to 191.255.255.255 16,384 64 thousand C 192.0.0.0 to 223.255.255.255 2,097,152 253 Almost all new networks going online today are using class C addresses. Class C addresses can support about 2 million networks: (223-192+1) x 256 x 256 = 2,097,152 class C networks Each class C network can nominally support up to 256 host computers. Reality falls slightly short of nominal in that some addresses are reserved. That is: 199.227.15.0 - represents the entire network 199.227.15.254 - represents the local IP address of the Worldgroup server on a SLIP/CSLIP/PPP pseudo-network (no such address is used up on an Ethernet however) 199.227.15.255 - is the destination address for packets to be broadcast to all hosts on the network These first and last addresses would normally never be used to designate host computers. The .0 address is used in certain contexts, mostly router configuration, to designate the entire network. And the .255 address is used by a broadcast packet to address all hosts within a network. The way IP addresses are used for SLIP/CSLIP/PPP users, the Worldgroup server needs an address on the network too. It always uses the one right before the broadcast address. Here's what's left over on a typical set of class C addresses that are allocated to SLIP/CSLIP/PPP users: 199.227.15.1 through 199.227.15.253 - addresses for SLIP/CSLIP/PPP users on the pseudo-network So this is how a class C network or set of addresses is broken down: the string of 256 addresses, only varying in the fourth number, includes at least a few addresses for special purposes. But intrepid TCP/IP network administrators, such as yourself, can also carve smaller networks out of the standard networks. These are subnetworks or subnets. Subnetting ---------- To assign IP addresses to SLIP/CSLIP/PPP users, you need to create a network, or sub-network, of IP addresses. These users are, at least conceptually, all part of the SLIP/CSLIP/PPP subnetwork. Breaking down a standard-sized network into smaller networks is almost always done with class A or class B networks, but it can also be done with class C networks. You can cut a class C network in half and have two 128-address networks. Or you could cut it into one 128-address network and four 32-address networks. (All numbers are nominal of course.) Netmasks show where the split takes place. The (nominal) number of hosts in a network is always a power of two, so that the 32 bits of the IP address can be split cleanly into a network part and a host part. This keeps the job of the network routers dirt-simple, so they can route lots of packets very quickly. So the only earthly purpose for netmasks is to empower networking software to make these cuts: to separate the part of the IP address that specifies the network, from the part that specifies a host within that network. Netmasks -------- A netmask looks a lot like an IP address but it's really something quite different. Here's the standard netmask for Class C addresses: 255.255.255.0 This netmask means that the left 24 bits (the left 3 bytes, as designated by the 255's) of an IP address are the network part and the right 8 bits (byte) is the host part. To create class C subnets, you have to split up those 8 bits on the right. Here are the possibilities. Rightmost byte Practical number of the netmask of hosts within a SLIP/CSLIP/PPP Binary Decimal Number of subnets pseudo-subnetwork -------- ------- ----------------- ----------------- 11111111 255 256 0 (impractical) 11111110 254 128 0 (impractical) 11111100 252 64 1 (not very practical) 11111000 248 32 5 11110000 240 16 13 11100000 224 8 29 11000000 192 4 61 10000000 128 2 125 00000000 0 1 253 (no subnetting) A netmask of 255.255.255.192, therefore, can be used to break a class C network into 4 subnets with up to 61 computers on each subnet. (Remember, three address values are reserved within each SLIP/CSLIP/PPP subnetwork, but only two on an Ethernet subnetwork). By the way, below are the standard netmasks for any of you who are lucky enough to be working with class A or B IP addresses. Standard Class IP address of your server Netmask ----- ---------------------------- ------- A 0.0.0.0 to 127.255.255.255 255.0.0.0 B 128.0.0.0 to 191.255.255.255 255.255.0.0 C 192.0.0.0 to 223.255.255.255 255.255.255.0 If your subnets are all smaller than 256 addresses (and most likely that's what you want), you'll want a netmask starting with 255.255.255. For the rightmost byte of the netmask, use one of the decimal numbers in the above table. What your Service Provider says is your Netmask ----------------------------------------------- Your service provider may tell you what "your" netmask is. This isn't necessarily the netmask you'll use in all cases however. It's really just telling you how many addresses your ISP is giving you to play with. (See the above table.) If you had only one network, then you would probably use that same netmask in all contexts. But if you're offering SLIP/CSLIP/PPP services to your users, then you have at least one additional network -- the SLIP/CSLIP/PPP pseudo-network -- and you need to compute your own netmasks for the purpose. Router Configuration -------------------- There's a special advantage to splitting up a class C network into one part for Ethernet connections and one for SLIP/CSLIP/PPP connections through the Worldgroup server: the router doesn't need to know about it. The router can pretend that all 254 possible addresses of the class C set are on the local LAN. So it can use the standard netmask for class C networks: 255.255.255.0. The Worldgroup server, on the other hand, through strategic setting of its netmasks and addresses, can take care of routing the packets destined for SLIP/CSLIP/PPP users. (By the way, the technical feature that makes this possible is that ICO will respond to ARP requests on the LAN for the SLIP/CSLIP/PPP users by claiming to be the proper recipient for those packets on the LAN.) This cutting in two of a class C set of addresses is exactly what we'll see in the following example. Example ------- Suppose you have a T1 connection to your Internet Service Provider, and he's also allocated you your own class C network. Let's say that 199.221.88.0 through 199.221.88.255 are yours to play with. (The Service Provider would probably tell you in this case that your IP addresses start at 199.221.88.1 and your netmask is 255.255.255.0. Don't let that fool you into using that netmask in all contexts though. Read on.) We'll chop the IP addresses cleanly in two so that half of the addresses are for hosts and devices on the Ethernet connected to the T1 line, and half are for assignment or dynamic allocation to users. T1 || ____||____ | | | DSU | |____ ____| ____||____ _________ | | | | | Router | | Host | |__________| |_________| | | | 199.221.88.1 | 199.221.88.4 | | _________________|_______________________________|___________________________ TCP/IP Ethernet LAN | | | | | | | | | 199.221.88.2 | | | 199.221.88.5 ____|____ | ____|____ | | | | | | Host | | | Host | |_________| | |_________| | | | 199.221.88.3 ________|________ | | | Worldgroup | | Server | |_________________| | | | | 199.221.88.129 | | 199.221.88.130 ________|___ __|__________ | | | | | PPP user | | SLIP user | |____________| |_____________| In this example, the PPP user has been assigned his own IP address, 199.221.88.129. The SLIP user is using 199.221.88.130. Here are some reasonable configuration settings for this arrangement: GALTCPIP.MSG ------------ IPADDR IP address of Worldgroup server (or AUTO): .... 199.221.8.3 NETMASK Netmask: .................................. 255.255.255.128 IPROUT IP address of router: ......................... 199.221.8.1 GALSCP.MSG ---------- SCPMAX Maximum number of SLIP/CSLIP/PPP sessions: 125 USERIPS Support assigned and dynamic user IP addresses? YES SCPIP SLIP/CSLIP/PPP sample assigned IP address: 199.221.88.129 SCPMASK SLIP/CSLIP/PPP netmask (or AUTO): 255.255.255.128 Notice that the netmasks end in 128, which is 10000000 in binary. (Recall from the above table, that this designates subnets of up to 125 hosts each.) This 10000000 binary means that, within the set of class C addresses starting with 199.221.88, bit 7 (numbered from the right starting at 0) determines whether a packet is associated with a SLIP/CSLIP/PPP user or with a host on the local Ethernet. Bits 0-6 determine which user or host within those groups a packet is for. Router algorithms love to deal in bits. Another way of saying this: Netmask 255.255.255.128 allows: ------------------------------- 199.221.88.1 - 199.221.88.126 to be used for Ethernet hosts 199.221.88.129 - 199.221.88.253 to be assigned to SLIP/CSLIP/PPP users Remember that every subnet must contain an integral power of two addresses (16, 32, 64, or 128 for example). With the standard netmask 255.255.255.0, all addresses starting with 199.221.88 must be associated with a single network -- there is no subnetting. The special netmask 255.255.255.128, which both NETMASK and SCPMASK are set to, splits the class C set of addresses into two subnetworks. Even though there are exactly 125 available IP address for SLIP/CSLIP/PPP users in this example, you wouldn't necessarily set SCPMAX to 125. You might set it to a lower value to limit Internet traffic for some reason (the nominal T1 rate is about 40 times that of a 38400 bps connection for example). You might set SCPMAX to a higher value because of all the proxy SLIP/CSLIP/PPP users you want to accommodate (who don't need their own IP addresses). The SCPIP setting, in this case 199.221.88.129, doesn't have to be the starting address. As long as you specify any address in the range you want for SLIP/CSLIP/PPP users, the first and last addresses are determined by the netmask.