Dynamic Network Configuration


To get a better understanding of the Mac OS X network architecture, you need to see how the pieces fit together. Look at what happens when you make a network setting change.


  1. You make a change to the TCP/IP settings of the default Ethernet port in the Network preferences pane, and click Apply.

  1. System Preferences writes to the preferences.plist file at /Library/Preferences/ SystemConfiguration/preferences.plist.

  1. System Preferences also notifies configd's Preference Monitor that preferences.plist has changed.

  1. Preferences Monitor reads the current set and determines the changes. It then changes the information stored in configd. (configd is a daemon, and therefore is always running.)

  1. The IP Configuration Agent receives the notification of the changes from configd and adjusts the configuration of any interface (starting DHCP, probing for an IP address collision, and so forth).

    Note

    Although these agents exist in bundles, they are hard coded into configd.


  1. If you had changed settings for the built-in modem, the PPP Controller would have been notified of changes relevant to PPP connections.

  1. If the order or availability of interfaces changes, the IP Monitor reevaluates which interface should be set as the primary interface and makes a change if necessary.

  1. Finally, configd will restart lookupd so that changes in the DNS settings are applied to the entire operating system.

Adapting to External Changes

Networking is dynamic in nature. Let's look at an example of how Mac OS X adapts to an external change.


  1. Someone unplugs the Ethernet cable.

  1. configd's Kernel Event Monitor notices the interface's link has changedin this case, it has gone downand notifies configd of the change in state.

  1. configd notifies the IP Configuration Agent of the change, and the IP Configuration Agent takes the interface offline. If the modem connection had been terminated, the PPP Controller would have been notified.

  1. Because the availability of an interface has changed, the IP Monitor reevaluates which interface should be set as the primary interface and makes a change to the routing table, if warranted.

  1. Finally, configd will restart lookupd to ensure that the correct DNS settings are now in place for the current network configuration.

Using ifconfig

Mac OS X includes the standard UNIX tool for configuring network interfaces, ifconfig. Both ifconfig and System Preferences make system calls to change the interface configuration. However, ifconfig and System Preferences do not communicate with each other.

Warning

ifconfig changes the network interface settings. If you use ifconfig, your system will be out of sync and will revert back to the contents of preferences.plist after a reboot. Also, while the terminal may be able to communicate with the network after editing with ifconfig, GUI applications may not work. This is why ifconfig should not be used to edit network configurations.


In early versions of Mac OS X, ifconfig was the only way to set the speed and duplex of a particular interface manually. As you learned in the previous lesson, users can now adjust their speed and duplex settings directly within System Preferences. These changes are written to preferences.plist and incorporated as a variable in a network location.

This new feature does not make ifconfig obsolete. ifconfig is the only way to view the entire interface configuration in one place, allowing easy examination of the current duplex state, speed, and MTU settings. This is particularly beneficial when your system is using an auto-negotiated Ethernet connection.

Note

Duplex mismatches are a common cause of poor network performance and connectivity issues. When troubleshooting network issues, make sure to run ifconfig and verify that the problem is not auto-negotiation.


Configuration Data

The majority of network configuration information is stored in preferences.plist. This file contains the various sets of configuration information that a user creates, such as different locations and interface configurations. NetworkInterfaces.plist is a database that gives persistent names to network interfaces. Both of these configuration files are unique to Mac OS X and are located in /Library/Preferences/SystemConfiguration.

One important note about hostconfig: Not all the information in hostconfig is useful, as some parameters are no longer used. In particular, the ROUTER property is still present yet has no function. It's a legacy attribute.

The /etc/hostconfig file is a standard UNIX configuration file and contains information about the status of some services. In addition, the /etc/hostconfig file contains network configuration information. The /etc/services file is a text file that contains the default port numbers designated to different services registered with the Internet Assigned Numbers Authority (IANA).

Some network configuration information is stored in the local NetInfo database, local.nidb. Note that the contents are not plaintext, so you need a tool such as NetInfo Manager or one of the NetInfo command-line tools to edit the local NetInfo database, such as nicl or dscl. It is important to back up the local NetInfo database along with the other configuration files. The local.nidb database is located in /var/db/netinfo.

Warning

It is best to maintain these files through System Preferences. If you make mistakes when you edit the configuration files manually, it may cause your system to be unstable and will be difficult to troubleshoot.





Apple Training Series. Mac OS X System Administration Reference, Volume 1
Apple Training Series: Mac OS X System Administration Reference, Volume 1
ISBN: 032136984X
EAN: 2147483647
Year: 2005
Pages: 258
Authors: Schoun Regan

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net