useful urls:
http://www.subnetmask.info/ subnet calculator!
http://www.cut-the-knot.org/binary.shtml- base converter for decimal to binary and many other bases
This module discusses the format of IP addresses.
The job of the internet layer is to break up streams of data passed by the transport layer software into packets called datagrams, direct packets to their destination, and to ensure that the entire message arrives and is properly reassembled. Directing packets to their destination is the function of routing. Breaking a data stream into packets small enough to be sent over the network and then reassembling those packets in the correct order at their destination are the functions of fragmentation, and defragmentation, performed as part of the Internet layer software tasks. The Internet layer also handles control, informational and error messages with ICMP. ICMP is the protocol used to send messages about the condition of routers and systems - ping and traceroute use ICMP echo requests.
Datagrams: The IP datagram contains the data payload, which may be a UDP datagram, a TCP segment (each of which contains application data) or it may contain an ICMP message such as an echo from ping, or an Internet Group Management Protocol (IGMP message which is part of IPv6). The header of the datagram is 20 bytes, of which the most important are the 8 bytes that form the source and destination IP addresses. Other fields identify the packet number and position in the original data stream so that the data stream may be reconstructed (defragmented) by the receiving system.
The IP address: Source and destination IP addresses are attached to the packet at the Internet layer. The IP address is a 32 bit address, broken into 4, byte-bounded, fields for notational convenience, and written in decimal, hexadecimal or binary format. The address is divided into two parts: the network number or "network prefix" first, and the host number second. The network prefix identifies the network with which the IP address is associated, and allows routers to send messages to the correct network, where they are delivered by the local router. The host number identifies a particular host, and allows local messages to be delivered.
Classful addressing: When the Internet was first set up, 5 classes of addresses were designated, of which 3 are used for assigning IP addresses to actual networks in use. Those 3 classes are A, B and C. The classes are administered and assigned by an organization called the ICANN (Internet Corporation for Assigned Names and Numbers), which has taken over from the InterNIC. Class A addresses are identified by the first bit (bit 0) of the address, which has the value zero. That limits the first byte of class A addresses to values between 010 and 12710. Practically, however, class A addresses include values from 110 to 12610, and exclude values beginning with 010, 12710 and 1010, since 0 is reserved for the unknown IP, 127 is reserved for the loopback address, and 10 is reserved for private networks. Class A networks use the 1st through 8th bits (bits 0 to 7) for the network address, and the last 3 bytes (24 bits) for the host address. Since 8 bits are used for the network prefix, Class A addresses are also referred to as "/8 prefixes." Since only 7 bits of the address can be changed, there can be only 27, or 128 (minus 3) class A networks, but each may contain 224, or over 16 million hosts. There are very few (if any), organizations which require such a large network, and mostly class A networks belong to Internet Service Providers (ISPs).
In class B networks, the first 2 bits of the IP address are 10, and the 3rd through 16th bits of the address make up the variable portion of the network prefix. There can therefore be 214 or 16384 networks of class B type, and each contains 216, or over 65,000 addresses each. The first 3 bits of class C networks contain the values 110, and the 4th through 24th bits (bits 3 through 23) are used for the remainder of the network prefix. There can therefore be over 2 million class C networks, each of which can include 28-2, or 254 hosts. (The values 0 and 255 may not be used in the host number in any network, since 0 implies the network prefix, and 255 the broadcast number.) In general, permission to use entire classes of IP addresses are acquired from ICANN by ISPs and chunks of these classes are resold to clients. The client can only use the IP addresses provided, not the entire class. The total of IP addresses in IPv4 exceeds 4 billion, but many of these are unusable, such as the loopback class (127.x.x.x), and they are being rapidly depleted.
The importance of classful addressing is disappearing. So few are useful, that organizations almost always use a subnet or supernet of a classful address. It makes much more sense to think of networks in terms of the number of bits of the address used for the network than in terms of a subnet or supernet of a classful address. This change in thinking and use of IP addresses is reflected in the network slash notation. Instead of having a "class A" address, you have a /8 address, and that way, having a /26 address is not so difficult to think about.
Private networks : Class A networks are too large for any organization, and only the largest corporations require even a class B network. Class C networks are too small for most companies. This means that classful IP addresses are not very useful and end up wasting lots of IP addresses. To manage this problem, 2 protocols were established: those governing the creation of private networks, and subnets. Private networks require at least one assigned, unique, IP address on a NAT (Network Address Translator) server, which provides network access to all systems in the organization's network. The systems behind the proxy server are assigned IP addresses from a set of such addresses reserved for private networks. The values of these addresses are never "seen" by systems on the Internet. Only the proxy server's IP address is visible to the Internet. The IP addresses in the private network are therefore infinitely reusable by different organizations, and may be set up at will by any organization.
Network addresses: A network is designated by its network address, which consists of the network portion of the IP address with zeros in the portion of the IP address reserved for the host number.
Broadcast addresses: Broadcast addresses send packets to all hosts in a specified area of the network. There are two types of broadcast address. The link-local broadcast address is 255.255.255.255. When a link-local broadcast packet is sent out, its time-to-live field is set to zero, so that it will never cross a router, and will be heard only by hosts on the local-link.
A network broadcast address is used to send packets to all hosts on a particular network, whether they are separated by routers or not. Such addresses consist of the network portion of the IP address for the given network, plus 1s in the host field. For a class A network, the broadcast address might be 124.255.255.255. For a class B network, it might be 190.181.255.255. For a subnetted class B system where 18 bits are used for the network prefix (a /18 prefix), and the network address is 190.181.64.0, the broadcast address would be 190.181.127.255.
Multicast addresses: Multicast addresses are those whose first byte is between 224 and 238. Those in the range 224.0.0.0 through 224.0.0.255 are link local. These addresses are reserved for low-level topology discovery or maintenance protocols. Datagrams destined to any of these are never forwarded by a multicast router. A device does not automatically accept and process these; it must be configured to do so by informing its network interface firmware to accept packets addressed to this interface. Recall that all packets are read by all interfaces on all hosts in a half-duplex Ethernet network, but that those packets are not necessarily passed to the operating system by the network interface chip. 224.0.0.1 is the link-local multicast to all, and all hosts capable of multicasting automatically configure themselves to belong to this group (multicast-to-all). Its behavior differs from that of the link local broadcast address (255.255.255.255) in that link-local broadcast packets go to ALL devices on a network, whether they are capable of multicasting or not. Thus, a printer will accept and process a broadcast packet, but probably won't accept a multicast- to-all packet, since it is not capable of multicasting, and therefore is unlikely to belong to the multicast-to-all group. The multicast is addressed to a MAC address constructed by adding the last three octets of the multicast IP address to the octets: 01:00:5e. Thus the multicast to routers, which has the IP address 224.0.0.2 goes to the MAC address 01:00:5e:00:00:02. All routers will configure their interfaces to accept packets with such an address.
A multicast-capable interface will show the tag "MULTICAST" when you run
ifconfig -a, which means it is able to be configured to filter the multicast addresses for the groups to which the device belongs and that it belongs to the multicast-to-all group. If an interface is not multicast-enabled, it passes all multicast packets to the internet layer, which filters for packets for groups to which it does not belong. As it works out, each MAC address for multicast maps to 32 different multicast groups, so the internet layer will always have to do some filtering for multicasts.
The netmask: The portion of the IP address that is the network prefix is used in routing packets to their destinations. For classful IP addresses, the first bit(s) of the IP address indicate how many bits are used in the network prefix, and how many are therefore the host number. From this information a "netmask" is set. The netmask is a 32 bit address in which the bits corresponding to those used for the network prefix are set to 1 and bits corresponding to those used for the host number are set to 0. It is used by a system sending a packet to determine whether a destination is on the local link, and if not, how it should be routed. Classful netmasks are set automatically as a default.
Networks do not have to use the classful address. For classless IP addresses, the netmask must be explicitly set, using ifconfig and the file /etc/inet/netmasks, since the prefix bits of the IP address don't indicate the number of bits used in the network address. Otherwise it works the same way that classful netmasks do. If no netmask is set for a classless network, the classful netmask will be assumed.
The number of contiguous bits used for the network address may also be indicated as a numerical value. This number is written after the IP address and separated from it with a /. Thus a class B address may also be written (for example): 132.238.15.27/16. The /16 (said "slash 16") indicates that 16 bits of the IP address are used for the network address. Class A addresses are now commonly referred to as "slash 8" addresses, and class C addresses as "slash 24" addresses. An address on a subnet of a class B network, which uses 3 bits of the third byte for the subnet number, is a /19 address.
Netmask numbers are commonly written in either decimal or hexadecimal format. The netmask of a class A network is 255.0.0.0 or ff000000 (in hexadecimal). The netmask of network 10.20.0.0 is 255.255.0.0 or ffff0000, even though a network starting with the number 10 is a class A network by definition. Thus netmasks distinguish between classful addresses and subnetted addresses. The netmask of network 10.20.1.132 /26
would be 255.255.255.196.
The netmasks for the local interface (and any others desired) are placed in the file /etc/inet/netmasks in the format
classful network number netmask in decimal (for a non-subnetted network)
OR
classful network number of parent network netmask (for a subnetted network)
These entries are used to decide which route a packet should use, and also to assign netmasks to interfaces as they come up. Netmasks are set at run level S, by the script /etc/init.d/network.sh. If a name service is running, the netmask will be recalculated at run level 2 by the script /etc/init.d/inetsvc.
More than you wanted to know: The netmask format above is that
specified for standard subnets in RFC 950.
It requires a classful parent network address, and is a type of
shorthand that implies the existence of multiple subnets. For example the entry
10.0.0.0 255.255.0.0
actually implies the entries:
10.0.0.0 255.255.0.0
10.1.0.0 255.255.0.0
10.2.0.0 255.255.0.0
10.3.0.0 255.255.0.0
10.254.0.0 255.255.0.0
Since standard subnetting
occurs only on classful addresses, you cannot use this format, with its
implication of multiple networks, on a non-classful network address, i.e., it
will not work with VLSM. So
10.0.0.0 255.255.0.0 is fine, since 10.0.0.0 is a class A network
address. So is
10.0.0.0 255.255.255.0. This is a classful address subnetted using
16 bits.
192.16.0.0 255.255.255.0 is ok
again, a
classful address for class B, subnetted using 24 bits.
10.100.0.0 255.255.255.0 is not a standard subnet, though the entry
itself is a perfectly good VLSM network.
The network number implies the base address is class B, since it uses 16
bits, but networks starting with 10 are class A! The network number is
therefore a subnet, and the entry must therefore be a VLSM type netmask
entry. For a VLSM netmask the actual
network number, not the parent network number, must be put in the file
/etc/netmasks, along with the correct netmask.
The entry 10.100.0.0
255.255.255.0 will ONLY work for
network 10.100.0.0, NOT any subnets of that network. If you want an entry for
subnetwork 10.100.100.0, the entry must look like:
10.100.100.0 255.255.255.0
Standard subnets:(RFC 950) Subnetting permits an organization to subdivide a set of IP addresses so that multiple networks can be created, without reference to IP address classes. In principle, subnetting is possible because the 4 fields of the IP address exist for convenience in writing the address, and there is no requirement that the network and host addresses be limited by their boundaries. If an organization has an entire class B network, it can then subdivide that network by using everything up to, for example, the 18th bit for the network address, and the remaining bits for the host address. The size of the network is then no longer constrained by the size of network classes, that is, it is no longer "classful" and has become "classless." If an organization has a /26 network, it can subdivide that into two /27 networks or four /28 networks, etc. If an organization needs about 500 IP addresses it can also take two /24 networks and turn them into one /23 network - that is, two class C networks can become oone /23 network in the process called supernetting. The differences between subnetting and supernetting are purely academic. An ISP will provide a set of addresses to a customer. That customer can then divide or combine them in any way desired to produce the required number of hosts per network. Whether this constitutes subnetting or supernetting is not important.
Subnets come in two trivially different varieties: "byte bounded", and "non-byte bounded". Byte bounded subnets poach an entire 8 bits from the host address portion of the IP address to use in the network address, while non-byte bounded subnets use only part of one of the fields. Subnetting works exactly the same way in either case. Part of the host number is used in the "extended network prefix," which expands the network prefix portion of the IP address. The portion of the host number used in the extended network prefix is called the "subnet number." The extended network prefix may use either continguous bits from the host field or non-contiguous bits, however, the process of subnetting is unnecessarily complicated when non-contiguous bits are used, and generally only contiguous bits are used.
Setting up a subnet:
1. Figure out how many bits you need to create the desired number of subnets: You can have 2, 4, 8, 16, 32, etc subnets. If you want 7 subnets you will have to create 8, and leave one unused. To number 8 subnets you will need 3 bits, since 8 = 23. The extra subnet can be used later. If you need 7 subnets now, you should probably actually use 4 bits for the extended network prefix, so you will have room for later growth.
2. Figure out how many hosts you can have on each subnet by counting the number of bits not used in the extended network number and raising 2 to that power. For example, if you subnet a class C network (/24) using 3 bits for the extended network number, you will have 5 bits left for the host number, enough for 25 (-2 for the broadcast number and network number) or 30 hosts per subnet. Make sure that is enough for your current needs and for growth. Get more IP addresses if necessary from your ISP.
3. Set up the subnets:
Base number: 193.1.1.0 11000001.00000001.00000001.00000000
Subnet #0 193.1.1.0 11000001.00000001.00000001.00000000
Subnet #1 193.1.1.32 11000001.00000001.00000001.00100000
Subnet #2 193.1.1.64 11000001.00000001.00000001.01000000
Subnet #3 193.1.1.96 11000001.00000001.00000001.01100000
Subnet #4 193.1.1.128 11000001.00000001.00000001.10000000
Subnet #5 193.1.1.160 11000001.00000001.00000001.10100000
Subnet #6 193.1.1.192 11000001.00000001.00000001.11000000
Subnet #7 193.1.1.224 11000001.00000001.00000001.11100000
4. Set up the host numbers on each subnet:
Base network number:
193.1.1.32 11000001.00000001.00000001.00100000
Broadcast number:
193.1.1.63 11000001.00000001.00000001.00111111
Netmask:
255.255.255.224 11111111.11111111.11111111.11100000
Host #0 193.1.1.33 11000001.00000001.00000001.00100001
Host #1 193.1.1.34 11000001.00000001.00000001.00100010
Host #2 193.1.1.35 11000001.00000001.00000001.00100011
Later
Host #30 193.1.1.62 11000001.00000001.00000001.00111110
5. Add an entry into /etc/inet/netmasks:
193.1.1.0 255.255.255.224
Variable Length Subnet Mask (VLSM- RFC 1519): Even subnetting may not allow an organization to use its addresses efficiently. In the previous example all the subnets had the same number of hosts. If one group needs a subnet, but has only 10 hosts, the other 20 available IP addresses will be wasted. VLSM allows the creation of subnets within subnets, recursively, as far as there are IP addresses left to subnet. A VLSM is set up on a subnet exactly the same way the subnet is set up on the base network address. VLSM will not work with RIP v. 1. RIP v. 1 does not provide netmask information with the router advertisement, unlike OSPF, IS-IS, RIP v. 2, or Cisco routing protocols. VLSM is supported in Solaris 2.6 and later, and its standards are spelled out in RFC 1519.
Files: Three files are involved in configuring an interface for use on the network. These are the file /etc/inet/hosts, which must contain the hostname and IP address to be used by each interface, the file /etc/nodename, which contains the "canonical" host name, and the file /etc/hostname.<interface> which also contains the host name associated with an interface.. All these files are automatically configured for the primary interface at boot time. The system's name can be changed permanently in these files, along with /etc/net/ticlts/hosts, /etc/net/ticots/hosts and /etc/net/ticotsord/hosts, or temporarily by using uname -S <newname> or hostname <newname>, which changes the name in RAM only. To configure additional interfaces beyond the primary interface, the file /etc/inet/hosts must be updated, and a file /etc/hostname.<interface> created. If you want to bring up an interface in IPv6, use /etc/hostname6.<interface>. Note that if the file /etc/hostname.<interface> does not contain the correct entry, the interface will be improperly configured, likely by having no IP address associated with that interface.
The canonical name of the system is the name associated with the system itself, as opposed to any particular interface. It is generally the same as the name associated with the primary interface, and is the value returned by the command "uname -n." and by processes and other commands that need or return a system name.
Network interface configuration: At boot time via /etc/rcS.d/S30network.sh, which reads /etc/hostname.<interface> and /etc/inet/hosts. At least one /etc/hostname.<interfaced> file must exist on the system if an interface is to be configured. The Solaris installation program creates just one such file for the primary interface during installation. The file /etc/hostname.<interface> applies to that interface and contains the hostname or IP address, along with any other item you want to pass to ifconfig. The file /etc/inet/hosts associates the hostname with an IP address. /etc/rcS.d/S30network.sh calls /sbin/ifconfig to configure interfaces with IP addresses and hostnames, and loads drivers. Then /etc/rc2.d/S72inetsvc calls /usr/sbin/ifconfig to reset any parameters changed by name services, which do not start until run level 2! Also: ifconfig may be run by the superuser directly (see below) to bring the interface up or down for reconfiguration, or to plumb or unplumb the device, which loads or unloads the driver modules.
Logical Interfaces: Ifconfig can also be used to configure logical interfaces, in which a second (or third, or ) IP address and hostname are attached to a physical interface. Logical interfaces are named<interface_name>:0 (the default), <interface_name>:1, <interface_name>:2, and so on. For example, hme0 can have logical interfaces hme0:1, hme0:2 up to hme0:8191. Use the logical interface name with ifconfig just as you would use a physical interface name: for example:
ifconfig eri0:1 plumb
192.68.1.25 up
will completely configure a logical interface. The addif option to ifconfig will add another logical interface to the specified physical interface with the given IP address as:
ifconfig eri0 addif 192.68.1.26 up
Logical interfaces can also be configured automatically at boot time, just like the physical interface, by creating a file /etc/hostname.<interface> (such as /etc/hostname.hme0:1) containing the hostname, and by entering its name and IP address in /etc/hosts. They can also be configured by adding the line:
addif <IP address> up
to the file /etc/hostname.<interface>. Logical interfaces are used for failover in clusters, where one machine has to assume the identity of a failed server, for web servers running multiple urls, and for some applications.
To bring down a logical interface use:
ifconfig eri0:1
down unplumb
You can also use:
ifconfig eri0:1 removeif 192.68.1.25
Acronyms:
ARPA Advanced Research Project Agency the government agency which sponsored the internet.
IAB Internet Architecture Board the organization which oversees Internet standards. It is the governing body of the IETF, which is formally charged with management of the
RFCs.
ICANN Internet Corporation for Assigned Names and Numbers oversight body which controls IP address allocation, and domain name allocation. ICANN has taken over the tasks former done by IANA and the InterNIC.
InterNIC INTERnet Network Information Center Organization which formerly oversaw the assignment of IP addresses
ICMP Internet Control Message Protocol an Internet level TCP/IP protocol, designed to handle error messages.
IGMP Internet Group Management Protocol the Internet level protocol which allows a system to send and receive multicasts.
IH Internet Header the 20 byte header on a packet containing destination and source IP addresses, time to live, precedence bits, fragmentation, etc.
NAT Network Address Translator a process that translates private network IP addresses to addresses usable on the Internet.
OSPF Open Shortest Path First a TCP/IP routing protocol.
TOS Type of Service field in an internet header indicating special handling for that packet, which may be "delay", "throughput" or "reliability."
TTL Time To Live how long (in hops or time or other metric) a message will continue to be passed between routers.
VLSM Variable Length Subnet Mask A subnet mask which subnets an existing subnet, or supernets an existing network. The default release of Solaris does not support VLSM routing, however Cisco routing protocols do, as does the daemon gated, which is part of additional software that may be purchased from Sun.
Definitions:
GateD a daemon which may be downloaded free, which supports VLSM routing via OSPF and BGP. It is not supported by Sun (but is commonly used).
in.routed daemon which populates the routing tables.
classful addressing IP addresses on networks without subnets: falls into Class A, B, or C categories.
classless addressing IP addresses including subnets.
trunking software which allows multiple interfaces to work as though they were one interface by using one IP address. Sun Trunking 1.1 allows a maximum throughput of 400 Mbps (via 4 quad fast ethernet ports), while Sun Trunking 1.2 allows throughput of up to 2000 Mbps (via 2 gigabit ethernet ports). Trunking not only allows faster throughput, but also load balancing, transfer of larger amounts of data and failover, depending on the trunking algorithm used. The algorithm may be round robin, in which each port is used in turn, or be based on the last 2 bits of the MAC address of the source and destination systems, on the destination IP address, or on a combination of the source and destination IP address.
link local area all hosts on a single network. They can communicate with each other without going through a router.
logical interface an interface with an IP address and a hostname configured on a physical interface which is already configured. Each logical interface is assigned a sequential number of one or greater in the format <interface-name>:<number>. For the first logical interface on hme0, the logical interface name would then be: hme0:1. The 15th logical interface on qfe3 would be qfe3:15. To set up a logical interface on hme0, for the IP address 128.28.3.1, create the file hostname.hme0:1 with the new host name in it, add it to /etc/hosts, then set with
ifconfig hme0:1 plumb 128.28.3.1 up
broadcast number the IP address which indicates a packet to be sent to all hosts. The limited broadcast number (255.255.255.255) is sent to all hosts in the link local area, while the net directed broadcast (network prefix plus all 1s) is sent to all hosts on the network. The limited broadcast sets the time to live field to zero, so that the message dies when it reaches a router.
multicast number the IP address which indicates a packet to be sent to a subset of all hosts. Multicast numbers exist for all hosts, for all routers, for all NTP servers, etc. A device must join a multicast group in order to receive packets sent to that group. This happens when software is installed on the system.
subnet mask A set of 4 octets used to indicate the portion of an IP address used for the network prefix, and the portion used for the host number. Bits used in the network prefix are represented as 1s in the netmask, while bits used for the host number are represented as 0s in the netmask.
subnet a network created as a subset of an existing class A, B or C network, and separated from the rest of the network by a router.
subnet number the portion of the host number on a classful network dedicated to the subnet portion of the extended network prefix.
byte-bounded subnet a subnet in which the subnet number takes up a full byte.
non-byte-bounded subnet a subnet in which the subnet number does not take up a full byte. Such subnets may consist of a variable number of hosts.
network number or network prefix the portion of an IP address used to indicate the network. In class A addresses, this is the first octet, in class B addresses this is the first two octets, and in class C addresses, the network prefix is the first 3 octets. In a subnet, the portion of the IP address used for the network prefix is variable in length, and is referred to as the extended network prefix.
host number the portion of an IP address used to indicate a unique host. It is composed of all bits not used in the network prefix. For a class A network, the host number is held in the last 3 octets, while for a class B network the host number is held in the last 2 octets.
extended network prefix the classful network prefix plus the portion of the host number used for the network in a subnet.
datagram the basic unit of data handled by the Internet Layer.
netmask a set of 4 octets used to indicate which part of an IP number is the network prefix and which part is the host number. The network prefix is indicated by 1s, and the host number by 0s. A netmask of 255.255.254.0 therefore indicates that the network prefix takes up the first 23 bits of the IP address.
hop limit the number of hops before a packet is discarded by a router as undeliverable. Default for Solaris is 15.
NOT a logical operator on one binary value which changes 1s to 0s and 0s to 1s
OR a logical operator on two binary values which changes 1 and 0 to 1 and leaves 1 and 1 as 1 and 0 and 0 as 0
AND a logical operator on two binary values which leaves 1 and 1 as 1, 0 and 0 as 0, and changes 1 and 0 to 0.
Commands: (note: in all commands, the hostname may be replaced by the corresponding IP address.)
ping [-<options>] < hostname >- sends out a packet to a destination host to see if it is
responding, and replies to the originating host.
-R Reply includes a maximum 9 hop Route trace (use with -vs)
-v verbose ping give detailed information on ping attempts and responses.
-s send out one ping per second.
traceroute <hostname> a troubleshooting utility which allows the tracing of up a
route of up to 30 hops. It sends out a datagram with the ttl set to 1, thus
eliciting an ICMP message from the first router on the route. It increments
the ttl, and resends the packet, discovering the route one step at a time.
in.routed <options> the daemon which populates the routing table
-q Run the router in quiet mode a host with multiple interfaces will come
up without advertising its routing information. This mode is used to set up
a multihomed host.
-s Run the router in speaking mode, where it advertises its routing
information.
ifconfig [-<options>]
<interface-name> display configuration information for the specified interface.
<interface-name> <IP address> set the IP address, classful netmask and
broadcast address for the specified interface.
<interface-name> netmask <netmask number> set the netmask to
the value
specified. This is the format for netmask that must be used for a
subnet.
<interface-name> <IP address> netmask + set the netmask based on the IP
address and the contents of /etc/netmasks. If there is no entry in /etc/netmasks, the classful netmask will be set. Entries must be in the order: IP, netmask.
<interface-name> broadcast <broadcast number> set the broadcast
number to the value specified.
<interface-name> netmask <netmask number> broadcast + - set the netmask explicitly and set the broadcast number based on the netmask. Entries must be in the order:netmask, broadcast.
<interface-name> broadcast + set the broadcast number to the current value
of the netmask.
<interface-name> <IP address> netmask + broadcast + set the IP
address, set the netmask from the IP address assuming classful addressing, and set the broadcast number from the netmask. Entries must be in the order: IP, netmask, broadcast.
<interface-name> plumb| unplumb plumb (or unplumb) the interface.
This starts (or stops) the streams drivers associated with the interface.
If the interface is unplumbed, there is no output from ifconfig <interface>.
If the interface is plumbed, the output from ifconfig <interface> includes
the flag "RUNNING." To restore an unplumbed interface, you must plumb
it, set its IP address, and bring the interface up. Use
<interface-name> plumb <IP address> up
"plumb" must come before the IP address, netmask or any other entry except the interface name in the ifconfig command line.
<interface-name> up|down bring the interface up (or down). This
enables (or disables) the interface, whether physical or virtual. Before any changes are made to it or before it is unplumbed, the interface must first be brought down. Once all changes are made, the interface must be brought up. Bringing it up sets the "UP" flag in the output from ifconfig <interface-name>, and allows the interface to send and receive messages.
<interface-name> plumb <IP address> netmask <netmask value> broadcast <broadcast value> up - set the IP, netmask and
address, set the netmask from the IP address, and set the broadcast number
from the netmask. Plumb the interface and bring it up. Entries must be in the order: IP, netmask, broadcast.
<interface-name> removeif <IP address of the interface> - unconfigures
whichever logical interface is associated with that address.
-a display's system's network information for all interfaces including interfaces configured, status, IP address, Mac address and netmask, and whether the interface is enabled or not.
-trailers Sets the NOTRAILERS flag, which disallows the use of BSD style encapsulation, in which header information followed the message in the packet, instead of preceding it. Since trailers are not ever allowed anymore, the flag is obsolete, and exists only for backwards compatibility.
ndd -set /dev/ip ip_addrs_per_if <value between 0 and 8191> sets
the number of IP addresses allowed per interface. Solaris 2.6 and later
support up to 8192 total IP addresses per interface. Earlier versions of
Solaris support up to 256.
Files:
6 files containing the hostname: (all must be changed if the name is changed)
/etc/net/ticotsord/hosts
/etc/net/ticots/hosts
/etc/net/ticlts/hosts - these three files are used by programmers and apply only to the loopback.
/etc/inet/hosts (maps IP addresses to hostnames)
/etc/nodename contains the canonical hostname, used by some daemons, like sendmail. Also used by multicast and SNMP. If this file has the wrong name, boot will complain.
/etc/hostname.<interface> Contains the name of a host, and is used to configure the interface specified in the filename with the hostname specified in the file. Thus, if the file /etc/hostname.hme0 contains the name "tomato", at boot time, the interface hme0 will be configured with the hostname "tomato." Instructions that may be included in the command "ifconfig" may also be included in this file: for example
addif 192.68.1.45 up
will add a logical interface associated with the physical interface that the file configures, and will bring it up with the specified IP address.
/etc/rcS.d/S30network.sh Start script that uses /sbin/ifconfig to configure the Ethernet and loopback interfaces, and which mounts /usr read-only.
/etc/inet/netmasks Contains the network prefix and netmask for each subnetted system. For subnets of classful addresses (RFC 950), the network prefix for a subnet will be of the parent network while the subnet number will be for the current subnet. Thus the file might contain the entry:
128.50.0.0 255.255.0.0 for a /16 (class B) network
128.50.0.0 255.255.128.0 for a /17 network subnetted on a /16 network
128.50.0.0 255.255.128. for a /17 network subnetted on a /16 network
128.50.0.0 255.255.255.192 for a /26 network subnetted on a /16 network
The last trailing zero in the netmask may be left off, but not the last dot.
For subnets of subnets (VLSM subnets, RFC 1519), an entry will be of the subnetwork followed by its netmask.
Misc:
Contents of an Internet header: (20 bytes) in order:
Version (IPv4 or IPv6) - 4 bits
Header Length - 4bits
Type of Service - 4 bits TOS field This contains 3 bits set to 1(on) or 0 (off). The bits apply to the possible options "delay," "throughput," and "reliability." They are requested by the application to optimize packet handling.
Datagram Length in bytes - 16 bits
Datagram Identifier - 16 bits - used to identify the packet so the receiving system can reassemble the data stream.
Flags - 4 bits - include:
Do not fragment bit - tells router not to subdivide the packet
Last Fragment Bit if set, indicates that the packet is the last piece of a message.
Fragment Offset - 12 bits - indicates where in the message a packet belongs, as packets may be received out of order, and have to be put back into order at the destination host before they are reassembled into a data stream. If packets do not all arrive in a given amount of time, they are discarded and an ICMP message is sent back to the originating host.
time to live 8 bits - possible values vary from 0 to 255. In Solaris, this is generally used to indicate how many hops are allowed before a message is discarded. When a packet reaches a router, the value of the ttl field is decremented by one. When a packet with a ttl of zero reaches a router, the packet is discarded, and an ICMP message documenting the loss of the packet is returned to the sender. Default ttl provided by the internet layer is 15.
Protocol - 8 bits
Header Checksum - 16 bits
Source IP address - 4 bytes
Destination IP address - 4 bytes
Options/Padding - 4 bits an optional field which may specify the following special behaviors or contain zeros:
-record route - if this bit is set, up to 9 addresses maximum are recorded along the route. This bit is set in packets generated by the command "ping R."
-strict source route (plus a list of approved IP addresses) the packet may take only the route given; no exceptions. This is a security feature.
-loose source route (plus a list of approved IP addresses) the packet must take the route given, but may also pass through other routers as well.
ICMP header-after IP header, contains:
Type Field contains generic error message, such as "Destination unreachable."
Data Field Contains 8+ bytes of the original message, if applicable
Code field Contains a code indicating the specific problem or result type, such as "Network unreachable."
Checksum
Output of ifconfig a or ifconfig <hostname>:
Name of interface, such as hme0 or qfe3
flags = Value, where Value is a numerical equivalent to the flags listed after the value.
Flags. The following flags are usually set, including one of IPv4 and IPv6.
IPv4 system is running IPv4 (new in Solaris 8)
IPv6 system is running IPv6 (new in Solaris 8)
UP interface is enabled, and can send and receive messages. If the interface is
down, this flag is absent, but no "DOWN" flag exists!.
NOTRAILERS header information may not be placed at the end of the packet.
RUNNING the kernel knows about the interface and its drivers are running it
is plumbed.
MULTICAST the interface is multicast enabled it will filter multicast
messages and pass on only those for which to which the device has
subscribed. Otherwise this task must be done by the internet layer at a large cost in performance.
BROADCAST the interface can broadcast.
mtu <value> - the maximum transmission unit for this interface is as specified (usually
1500).
index <value> - the value given is the number assigned by the operating system to identify that interface. 1 is loopback, 2 is usually the primary interface (hme0 or qfe0 )
inet <IP address>
netmask <netmask in hexadecimal>
broadcast <broadcast address>
MAC <ethernet address>
|
class |
first bit(s) |
# of nets |
# of nets |
bits in network # |
hosts per net |
first octet of IP |
|
A |
0 |
27 |
125 (no 0, 10,127) |
8 |
224=16,000,000 |
0-127 |
|
B |
10 |
214 |
16,382 (no 0,1) |
16 |
216=65,534 |
128-191 |
|
C |
110 |
221 |
2 million |
24 |
28=254 |
192-223 |
|
D |
1110 |
|
multicast |
|
|
224-239 |
|
E |
1111 |
|
experimental |
|
|
240-254 |
Special IP addresses:
255.255.255.255 11111111.11111111.11111111.1111111 broadcast sent to all hosts on the link local area
network prefix + all 1s in remaining bits broadcast sent to all hosts on the network
network prefix + all 0s in remaining bits network prefix
0.0.0.0 00000000.00000000.00000000.00000000 network address refers to the entire link local net
127.0.0.1 01111111.00000000.00000000.00000001 loopback address
224.0.0.1 01111100.00000000.00000000.00000001 multicast to all hosts on network
224.0.0.2 01111100.00000000.00000000.00000010 multicast to all routers
224.0.1.1 01111100.00000000.00000001.00000001 multicast to all NTP servers
224.0.1.8 01111100.00000000.00000001.00000100 multicast to all NIS+ servers
239.248.0.0 to 239.251.255.255 multicast addresses for allocation
10.0.0.0 to 10.255.255.255 class A private networks
172.16.0.0 to 172.31.255.255 class B private networks
192.168.0.0 to 192.168.255.255 class C private networks
255.0.0.0 11111111.00000000.00000000.00000000 class A netmask (ff:00:00:00)
255.255.0.0 11111111.11111111.00000000.00000000 class B netmask (ff:ff:00:00)
255.255.255.0 11111111.11111111.11111111.00000000 class C netmask (ff:ff:ff:00)
0.x.x.x, 128.0.x.x, 191.255.x.x, 129.0.0.x, 223.255.255.x reserved by the ICANN
Ethernet number for multicast: 01:00:5E + last 24 bits of IP address
Ethernet number for router multicast: 01:00:5E:00:00:02
More than you want to know: If the IP address of a multicast starts with anything from 224.0.1.0 to 238.255.255.255, its scope is global, and it is forwarded by routers throughout the network. From 239.253.0.0 to 239.253.255.255 is the site local multicast address range, and from 239.192.0.0 to 239.194.255.255 is the organization local scope. The exact meaning of these is up to the developers. Multicast addresses may also be allocated: addresses in the range 239.251.0.0 to 239.251.255.255 are currently part of the allocation scope, which are available for allocation to developers of applications requiring a multicast address for a limited time. In general, the ability to pick up these multicasts must be manually configured in the system or in an application. The scope simply determines how many hops are placed into the TTL field of the datagram. Site local multicasts conventionally allow less than 32 hops so hosts more than 32 hops from the original host will not get the multicast. Applications using multicast may however, allow any number of hops, there is no requirement that the convention be followed.
Calculation of the network prefix:
<IP of host> AND <netmask>
Calculation of the broadcast number:
<network prefix> OR (NOT <netmask>)
Alternately: network prefix + all 1s
Calculation of the subnet number:
(<IP of host> AND <netmask>) OR (NOT <netmask>)
Alternately: make network prefix all 1s plus host number
Base 2
|
Power of 2 |
Value |
Breakdown |
|
0 |
1 |
|
|
1 |
2 |
|
|
2 |
4 |
|
|
3 |
8 |
|
|
4 |
16 |
|
|
5 |
32 |
|
|
6 |
64 |
|
|
7 |
128 |
|
|
8 |
256 |
|
|
9 |
512 |
|
|
10 |
1024 (1 kbyte) |
|
|
20 |
1 Mbyte |
210 x 210 |
|
30 |
1 Gbyte |
210 x 210 x 210 |
|
40 |
1 Tbyte |
210 x 210 x 210 x 210 |
Some values of a byte:
|
Base 2 |
Base 10 |
Base 2 |
Base 10 |
|
00000000 |
0 |
00001011 |
11 |
|
00000001 |
1 |
00001100 |
12 |
|
00000010 |
2 |
00001101 |
13 |
|
00000011 |
3 |
00001110 |
14 |
|
00000100 |
4 |
00001111 |
15 |
|
00000101 |
5 |
00010000 |
16 |
|
00000110 |
6 |
00011111 |
31 |
|
00000111 |
7 |
00100000 |
32 |
|
00001000 |
8 |
00111111 |
63 |
|
00001001 |
9 |
01000000 |
64 |
|
00001010 |
10 |
01111111 |
127 |
Uses:
Logical interfaces: Required in clusters for failover. May be used in web servers, some applications, because it is cheaper than buying an additional interface. It is also easier to administer, but slows the boot and may slow networking on the host.
multicasting: reduce traffice, resource discovery
subnetting: reduce traffic, reduce access to subnetted systems for security, have subnets running varying protocols, have a network for one area or group, organize administrative work.
VLSM: routing aggregation, more efficient use of IP addresses.
Changes in scripts from Solaris 7:
Essentially, Solaris 8 "lifted" the network related configuration steps (dhcp, configuring and plumbing interfaces) out of rootuser.sh and made them a separate script called "S30network.sh". (It also added in appropriate steps related to IPv6). However, the original "rootusr" script remains to still serve the purpose of establish proper mounts for '/' and '/usr' during the building of Single-User mode.