Contained WithinFind More DocumentationFeatured Support Resources | PDF로 이 문서 다운로드 (171 KB)
Chapter 3 Setting Up EthernetThis chapter takes you through the process of setting up an Ethernet connection for a ChorusOS system. The ChorusOS Ethernet interface provides the standard solution for high-speed network connections with other systems. However, if your system does not support Ethernet, or if you do not plan to use Ethernet with your system, you may skip this chapter. Hardware ConfigurationChorusOS systems may support multiple Ethernet devices that all have their own Ethernet interface. See the appropriate guide in the ChorusOS 4.0 Target Family Documentation Collection for the list of supported Ethernet devices for your particular target system hardware. If you are unsure which Ethernet device your system uses, yet you are able to boot the system, you can use the dtree(1M) utility to display devices listed in the target system device tree:
A ChorusOS system often uses the Ethernet interface in conjunction with the Dynamic Host Configuration Protocol (DHCP) client or Reverse Address Resolution Protocol (RARP) to obtain an IP address at boot time. As the system runs, it uses the Address Resolution Protocol (ARP) to find the Ethernet addresses of other systems, based on their IP addresses. Interface CreationAs described in Chapter 1, Introduction, many network administration
tasks are performed during system initialization when the commands in sysadm.ini(4CC)
are executed by the mkdev ifeth unit [pathname] where unit is the number that makes the interface unique and pathname is as shown in the output from the dtree(1M) utility. If you do not include pathname in the command, the ChorusOS system simply attaches the interface to the first free device it finds. Note - At this point, the network interface is bound to the Ethernet low-level driver, but Ethernet is not configured for use. Example 3-1 Ethernet Interface CreationThe following example sysadm.ini fragment creates an interface for an Ethernet device and the loopback interface needed for IP communication. # # Set the file creation mask to 0 during system configuration # umask 0 # # Create an Ethernet interface for the first available device # # Since no dtree *pathname* is provided, the system uses the first # device it finds # mkdev ifeth 0 # # Create a loopback interface # # Note that the loopback device is not attached to a device in # the dtree, so no *pathname* argument is provided here, either # mkdev lo 0 Device CreationEthernet connections only require corresponding devices if you configure Ethernet interfaces using the dhclient(1M) or rarp(1M) utility. Both of these utilities require a Berkeley Packet Filter (BPF). It is also possible that your applications require a BPF device for raw access to network packets. In order to create the BPF device, you can include commands of the following form in the sysadm.ini file that you build into the system image for your target: # Create the BPF device mkdev bpf unit # Create the associated special file mknod /dev/bpfunit c 23 unit where unit is the number that makes the interface unique. Note that mknod(1M) is used to create special files. The c refers to the fact that BPF devices are character devices, and 23 is, by convention, the major number used for BPF devices. Example 3-2 BPF Device CreationThe following example sysadm.ini fragment creates an interface for an Ethernet device and the loopback interface needed for IP communication. It then creates a BPF device needed by dhclient(1M) and rarp(1M). # # Set the file creation mask to 0 during system configuration # umask 0 # # Create an Ethernet interface for the first available device # # Since no dtree *pathname* is provided, the system uses the first # device it finds # mkdev ifeth 0 # # Create a loopback interface # # Note that the loopback device is not attached to a device in # the dtree, so no *pathname* argument is provided here, either # mkdev lo 0 # # Create a Berkeley Packet Filter device and special file # # The BPF device is used by either the rarp or dhclient command to # configure the Ethernet interface # mkdev bpf 0 mknod /dev/bpf c 23 0 Interface ConfigurationIt is not enough to create an Ethernet interface for Ethernet to work on a ChorusOS system. Once an interface has been created, you must configure it. Configuring the interface means providing an IP address, a subnet mask and a broadcast mask, and setting the status of the interface to up or down, depending on whether you want it to be operational. Three utilities are provided to configure Ethernet interfaces on ChorusOS systems:
Example 3-3 Ethernet Configuration with ifconfigThe following example sysadm.ini fragment creates an interface for an Ethernet device and the loopback interface needed for IP communication. It then configures the Ethernet interface. # # Set the file creation mask to 0 during system configuration # umask 0 # # Create an Ethernet interface for the first available device # # Since no dtree *pathname* is provided, the system uses the first # device it finds # mkdev ifeth 0 # # Create a loopback interface # # Note that the loopback device is not attached to a device in # the dtree, so no *pathname* argument is provided here either # mkdev lo 0 # # Set the file creation mask back to the default value # umask 22 # # Configure the Ethernet interface using ifconfig # # Note that ADMIN_IFCONFIG must be set to true in order for this to # work # ifconfig ifeth0 129.157.197.88 netmask 0xffffff00 broadcast 129.157.197.255 up # # Configure the loopback interface as well # ifconfig lo0 127.0.0.1 up Example 3-4 Ethernet Configuration with rarpThe following example sysadm.ini fragment creates an interface for an Ethernet device and the loopback interface needed for IP communication. It then creates a BPF device needed by rarp(1M) and configures the interface. # # Set the file creation mask to 0 during system configuration # umask 0 # # Create an Ethernet interface for the first available device # # Since no dtree *pathname* is provided, the system uses the first # device it finds # mkdev ifeth 0 # # Create a loopback interface # # Note that the loopback device is not attached to a device in # the dtree, so no *pathname* argument is provided here either # mkdev lo 0 # # Create a Berkeley Packet Filter device and special file # # The BPF device is used by either the rarp or dhclient command to # configure the Ethernet interface # mkdev bpf 0 mknod /dev/bpf c 23 0 # # Set the file creation mask back to the default value # umask 22 # # Configure the Ethernet interface using rarp # # Note that BPF and ADMIN_RARP must be set to true in order for this # to work # # rarp requires a BPF device # rarp ifeth0 # # Configure the loopback interface as well # ifconfig lo0 127.0.0.1 up Example 3-5 Ethernet Configuration with dhclientThe following example sysadm.ini fragment creates an interface for an Ethernet device and the loopback interface needed for IP communication. It then creates a BPF device needed by dhclient(1M) and configures the interface. # # Set the file creation mask to 0 during system configuration # umask 0 # # Create an Ethernet interface for the first available device # # Since no dtree *pathname* is provided, the system uses the first # device it finds # mkdev ifeth 0 # # Create a loopback interface # # Note that the loopback device is not attached to a device in # the dtree, so no *pathname* argument is provided here either # mkdev lo 0 # # Create a Berkeley Packet Filter device and special file # # The BPF device is used by either the rarp or dhclient command to # configure the Ethernet interface # mkdev bpf 0 mknod /dev/bpf c 23 0 # # Set the file creation mask back to the default value # umask 22 # # Configure the Ethernet interface using dhclient # # Note that BPF must be set to true in order for this to work # # dhclient requires a BPF device # # dhclient also requires that the dhclient.r actor be included in the # system image # arun /image/dhclient ifeth0 & # # dhclient does not return until the server has responded # # Wait until the Ethernet interface is up to avoid confusing the system # ifwait ifeth0 # # Configure the loopback interface as well # ifconfig lo0 127.0.0.1 up Trying Out the InterfaceOnce you think the interface is properly configured, verify that the Ethernet connection is working:
|
||