Friday, May 18, 2007

Solaris x86

Hardware:

To setup the server testing enviroment, Sun utral 20 box is used. This box has two harddisks: (1)/dev/dsk/c1d0 and (2)/dev/dsk/c2d0

During installation of the Solaris 10, the first harddisk is used to install the boot, swap and root partitions. Basically, which likes the normal linux setting up.

The second harddisk /dev/dsk/c2d0 is left for the "zpool", although zpool can also use the extra space in the first disk.

After OS installation, the system status is : Solaris OS is installed in the first hardisk (/dev/dsk/c1d0). And the second harddisk is totally not used.

--------------------------After the installation of OS-------------------------
(1)create resource pool by command zpool
#zpool create spool c2d0
(2)now the pool named "spool" is created. Which can be listed by:
#zpool list
(3)Creating a ZFS File System by allocating space from the pool "spool"
#zfs create spool/z1fs
(4)now, new ZFS file system is created, which can be listed by:
#zfs list
(5)Now, it is time to create the parent directory of all zones: In the following, /zones directory is created.
#mkdir /zones
(6)To create zone "z1", i create directory /zones/z1,
#mkdir /zones/z1
(7)and mount the newly create ZFS spool/z1fs to /zone/z1
#zfs set mountpoint=/zones/z1 spool/z1fs
(8)and set the quato for ZFS spool/z1fs
#zfs set quota=10G spool/z1fs
(9) It is time to create zone z1 now:
#zonecfg -z z1
z1: No such zone configured
Use 'create' to begin configuring a new zone
zonecfg:myzone< create
zonecfg:myzone< set zonepath=/zones/z1
zonecfg:myzone< verify
zonecfg:myzone< commit
zonecfg:myzone< exit
(10)Install the zone by using the zoneadm
#chmod 700 /zones/z1
#zoneadm -z z1 install
(11)Boot the zone to complete the installation, using the zoneadm command.
# zoneadm -z z1 boot
(12)Use the zlogin command to connect to the zone console and answer the initialization questions:
#zlogin -C z1
(13)to shutdown zone
#zlogin z1 init 5

----------------------------------------------------

Configure network for the zone

Context: the Sun utral 20 box has only one physical network interface. To make the zone created network accessable, one logical interface will be assigned to each zone.

(1)list the physical network interface on Sun utral 20 box:
#ifconfig -a
The result shows that the physical network interface is nge0
(2)create logical interface and assign it to zone z1 and then up the logical interface:
#ifconfig nge0:1 plumb 192.168.1.89 netmask 255.255.255.0 zone z1 up
(3)login into z1:
#zlogin z1
(4)modify /etc/ssh/sshd_config , so that "root" can be used to do remote login
(5)restart sshd:
#svcadm restart ssh

------------------------------------------------------------------

DNS clients configuration:

After zone is running, it could encount such a problem: When you do ping to other computer, the naming resolving does not work. This is due to the DNS client configuration is not correct.

All DNS clients require the presence of the /etc/nsswitch.conf and /etc/resolv.conf files. Note that the DNS server must also be configured as a DNS client if it intends to use its own DNS services.

The /etc/nsswitch.conf file specifies the resolver library routines to be used for resolving host names and addresses. Modify the /etc/nsswitch.conf file by editing the hosts entry and adding the dns keyword. To ensure proper network interface configuration during the boot process, make sure that the files keyword is listed first. The following example shows a hosts entry configured for DNS:

hosts: files dns

The /etc/resolv.conf file specifies the name servers that the client must use, the client's domain name, and the search path to use for queries.

; resolv.conf file for DNS clients of the one.edu domain
domain office1.abc.net
nameserver 192.168.1.119
search office1.abc.net

Observe that the search keyword specifies domain names to append to queries that were not specified in the FQDN format. The first domain listed following the search keyword designates the client's domain. If both "domain" and "search" keywords are present, then the last one in the file is used and the other one(s) are ignored.

The nameserver keyword specifies the IP address of the DNS servers to query. Do not specify host names. You can use up to three nameserver keywords to increase your chances of finding a responsive server. In general, list the name servers that are nearer to the local network first. The client attempts to use the loopback address if there is no nameserver keyword or if the /etc/resolv.conf file does not exists.

------------------------------------------------------------------------

Configure DHCP client

After crashing of sun ultra 20 box, a dell box with onboard networking card is used to install solaris.

Problem 1: solaris doesn't support this on-board networking card.
Solution: a standalone PCI network card is used.

Problem 2: Solaris cannot detect this PCI card, and what is the interface name of this card?
Solution: Google suggest to try names like le0, iprb0, elxl0 and rtls0 etc.

Problem3: how to configure the DHCP client?
Solution: for a network interface, to configure it DHCP, create two empty files under /etc directory:
(a)hostname.INTERFACENAME , (b)dhcp.INTERFACENAME

After trying google suggested interface names, it is found that elxl0 is correct for this card.

--------------------------------------------------------------------------

Configure static IP addresses for the solaris box:

Network Interface Cards are what allow your system to talk to the network. When they don't work, neither do you. I will cover how to configure, troubleshoot, and modify your interfaces. I will not be covering routing issues, that will follow in the next article. My goal here is to get your interface up and properly running.

The first place to start is installing and testing the hardware. Once you have installed the hardware, SPARC systems can be tested at the EPROM level to verify the network interface cards. Use the manual that accompanies the interface card on how to test that specific card. Solaris x86 is a little different, as there is no true EPROM, and the drivers are different. However, Solaris x86 2.6 is Plug and Play compatible, and I have had fairly good luck adding network interface cards.

Once you have confirmed at the hardware and driver level that everything works, the fun can begin. The place to start is the ifconfig command. This powerful command allows you configure and modify your interfaces in real time. However, any modifications made with ifconfig are not permanent. When the system reboots, it will default to its previous configuration. I will first show you how to make all modifications with the ifconfig command. The second half of this article will cover making these modifications permanent by modifying the proper configuration files.
ifconfig

ifconfig -a

will show you which interfaces are currently installed and active. Remember, just because you added the physical network interface card does NOT mean it is active. If you do an ifconfig before you have configured the device, the interface will not show up. Once configured however, the typical output of the ifconfig -a command would look like this:

lo0: flags=849 mtu 8232
inet 127.0.0.1 netmask ff000000
elxl0: flags=863 mtu 1500
inet 192.168.1.132 netmask ffffff00 broadcast 192.168.1.255
ether 8:0:20:9c:6b:2d

Here we see two interfaces, lo0 and elxl0. lo0 is the standard loopback interface found on all systems. elxl0 is a 10/100 Mbps interface. All hme interfaces are 10/100 Mbps, all le interfaces are 10 Mbps, all qe interface are quad 10 Mbps, and qfe interfaces are quad 10/100 Mbps. There are three lines of information about the interface. The first line is about the TCP/IP stack. For the interface elxl0, we see the system is up, running both broadcast and multicast, with a mtu (maximum transfer unit) of 1500 bytes, standard for an Ethernet LAN. Notrailers is a flag no longer used, but kept for backwards compatibility reasons.

The second line is about the IP addressing. Here we see the IP address, netmask in hexadecimal format, and the broadcast address. The third line is the MAC address. Unlike most interfaces, Sun Microsystems's interfaces derive the MAC addressing from the NVRAM, not the interface itself. Thus, all the interfaces on a single SPARC system will have the same MAC address. This does not cause a problem in routing, since most NICs are always on a different network. Note, you must be root to see the MAC address with the ifconfig command, any other user will only see the first two lines of information.

The first step in bringing up an interface is "plumbing" the interface. By plumbing, we are implementing the TCP/IP stack. We will use the above interface, elxl0, as an example. Lets say we had just physically added this network interface card and rebooted, now what? First, we plumb the device with the plumb command.

ifconfig elxl0 plumb

This sets up the streams needed for TCP/IP to use the device. However, the stack has not been configured as you can see below.

elxl0: flags=842 mtu 1500
inet 0.0.0.0 netmask 0
ether 8:0:20:9c:6b:2d

The next step is to configure the TCP/IP stack. We configure the stack by adding the IP address, netmask, and then telling the device it is up. All this can be down in one command, as seen below.

ifconfig elxl0 192.168.1.132 netmask 255.255.255.0 up

This single command configures the entire device. Notice the up command, which initializes the interface. The interface can be in one of two states, up or down. When an interface is down, the system does not attempt to transmit messages through that interface. A down interface will still show with the ifconfig command, however it will not have the word "up" on the first line.
Virtual interfaces

Before moving on to the configuration files, I would first like to cover virtual interfaces. A virtual interface is one or more logical interfaces assigned to an already existing interface. Solaris can have up to 255 virtual interfaces assigned to a single interface.

Once again, lets take the interface elxl0 as an example. We have already covered how to configure this device. However, lets say the device is on a VLAN (virtual LAN) with several networks sharing the same wire. We can configure the device elxl0 to answer to another IP address, say 172.20.15.4. To do so, the command would be the same as used for elxl0, except the virtual interface is called elxl0:*, where * is the number you assign to the virtual interface. For example, virtual interface one would be elxl0:1. The command to configure it looks as follows.

ifconfig elxl0:1 172.20.15.4 netmask 255.255.0.0 up

Once you have configured the virtual interface, you can compare elxl0 and elxl0:1 with the ifconfig command.

elxl0: flags=843 mtu 1500
inet 192.168.1.132 netmask ffffff00 broadcast 192.168.1.255
ether 8:0:20:9c:6b:2d
elxl0:1: flags=842 mtu 1500
inet 172.20.15.4 netmask ffff0000 broadcast 172.20.255.255

Here you see the two devices, both of which are on the same physical device. Notice how the virtual interface elxl0:1 has no MAC address, as this is the same device as elxl0. We can repeat this process all the way up to elxl0:255. The operating system and most applications will treat these virtual devices as totally independent devices.

Note, Matthew A. Domurat has identified a "bug" with Solaris 2.6. When working with virtual interfaces, Solaris 2.6 will randomly select one of the interfaces as its source address for every packet sent. These are the patches to fix this:

* 105786-05: SunOS 5.6: /kernel/drv/ip patch
* 105787-04: SunOS 5.6_x86: /kernel/drv/ip patch

Configuration files

Now you know how to configure your network interface cards. Unfortunately, any modifications, additions, or deletions you make with ifconfig are only temporary, you will lose these configurations when you reboot. I will now discuss what files you have to configure to make these changes permanent.

The place to start is the file /etc/hostname.*, where * is the name of the interface. In the case of elxl0, the file name is /etc/hostname.elxl0. The virtual interface elxl0:1 would have the file name /etc/hostname.elxl0:1. This file has a single entry, the name of the interface. This name is used in the /etc/hosts file to resolve name to IP address.

The file /etc/hostname.* is critical, this is what causes the device to be plumbed. During the boot process, the /etc/rcS.d/S30network.sh file reads all the /etc/hostname.* files and plumbs the devices. Once plumbed, the devices are configured by reading the /etc/hosts and the /etc/netmasks file. By reading these two files, the device is configured for the proper IP and netmask, and brought to an up state. Lets take the device elxl0 as an example. During the boot process, /etc/rcS.d/S30network.sh looks for any /etc/hostname.* files. It finds /etc/hostname.elxl0, which contains the following entry.

homer

/etc/rcS.d/S30network.sh looks in /etc/hosts and resolves the name homer with an IP address of 192.168.1.132. The device elxl0 is now assigned this IP address. The script then looks at /etc/netmasks to find the netmask for that IP address. With this information, the startup script brings up interface elxl0 with an IP address of 192.168.1.132 and a netmask of 255.255.255.0. It may seem redundant having the script review the netmask of a class C address. However, do not forget that, starting with 2.6, Solaris supports both classless routing and VLSM (Variable Length Subnet Masks), both of which I will discuss in my next article.

As you have seen in this example, there are three files that must be modified for every interface. The first is /etc/hostname.*, this is the file you create to designate the interface's name. The second file is /etc/hosts, here you resolve the IP to the interface name. Last is /etc/netmasks, this is where you define the netmask of the IP address.

--------------------------------------------------------------
Install Solaris OS and partition on Dell Box

The Dell Box has one IDE harddisk with about 120G capacity. Solaris identifies this disk to be c0d0.

During installation, fdisk partition it as
c0d0s0 which mount on /
c0d0s1 ----swap
c0d0s7 ----/export/home
c0d0s3,4,5,6 all not used but with 20G space. they will be used as the resources of the resource pool created by zpool.


----------------------------------------------------

create harddisk resource pool

(1)#zpool create spool c0d0s3
(2)#zpool add spool c0d0s4
(4)#zpool list
NAME SIZE USED AVAIL CAP HEALTH ALTROOT
spool 39G 196K 39.0G 0% ONLINE

-----------------------------------------------------------

set static IP for global zone:

refer to the doc on above comments....

To set static IP for global zone:

(1)create /etc/hosts file. so that:
#less hosts
#
# Internet host table
#
192.168.1.23 benchmark1
(2)create /etc/hostname.elxl0 so that:
#less hostname.elxl0
benchmark1

After these two files created, global zone are network enabled.

-----------------------------------------------------------------
setup static ip for zone benchmark2 (non-global zone)

After login into global zone,

if doing #ifconfig -a,
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
elxl0: flags=1000843 mtu 1500 index 2
inet 192.168.1.23 netmask ffffff00 broadcast 192.168.1.255
ether 0:1:2:12:67:53

#zonecfg -z benchmark2

=>add net
==>set ip=192.168.1.23
==>set physical=elxl0
...
and commit

After boot zone benchmark2, Now, do #ifconfig -a again:
lo0: flags=2001000849 mtu 8232 index 1
inet 127.0.0.1 netmask ff000000
lo0:1: flags=2001000849 mtu 8232 index 1
zone benchmark2
inet 127.0.0.1 netmask ff000000
elxl0: flags=1000843 mtu 1500 index 2
inet 192.168.1.23 netmask ffffff00 broadcast 192.168.1.255
ether 0:1:2:12:67:53
elxl0:1: flags=1000843 mtu 1500 index 2
zone benchmark2
inet 192.168.1.22 netmask ffffff00 broadcast 192.168.1.255

It indicates that non-global zone is already network enabled.

-----------------------------------------------

JBOSS setup

Copy jboss from zpeter4:

Including:
(1)/opt/jboss-4.0.4.GA
(2)/var/jboss
(3)/opt/bin/myip (this is used in jboss's run.sh file)
(4)if java security manager is included in the java parameter, make sure the corresponding policy file also there

---------------------------------------------------


JBOSS user

(1)user jboss must be created
(2)group jboss must be created
(3)home directory of user jboss must be /var/jboss

[ Show » ]
Peter Yang [16/May/07 12:27 PM] JBOSS user (1)user jboss must be created (2)group jboss must be created (3)home directory of user jboss must be /var/jboss

----------------------------------------------------------

Setup SMF for jboss:

(1)export smf script from zpeter4
#svccfg export jboss >/tmp/jboss.xml

and copy this exported file to new zone benchmark2.

(2)Copy /opt/lib/svc/method/svc-jboss from zpeter4 to benchmark2 zone in the corresponding directory

(3)import manifect file jboss.xml in benchmark2 zone.
/usr/sbin/svccfg -v import /tmp/jboss.xml

(4)enable jboss
#svcadm enable jboss

(5)monitoring the status of jboss service
#svcs -xv jboss

------------------------------------------------

how to remove service or edit manifest file

svcadm -v disable svc:/network/jboss
svccfg -v delete svc:/network/jboss
svccfg -v import /var/svc/manifest/jboss.xml

----------------------------------------------------


How to run NFS file server and mount NFS client

Problem:

For the development enviroment, there are four JBOSS servers. To enable the web log feature of the portal, it is required for all these JBOSS server to send their log files to a central NFS server, on which jbossportal server is running.

Parameters:
(1)JBOSS servers:
zpeter2, zpeter3, zpeter4 and benchmark2 (dell computer)

(2)NFS file server is running on storm, on which zroland3 zone is running. JBossPortal is running with zroland3 zone.

Steps:
(1)edit /etc/dfs/dfstab on storm to include following lines:
share -F nfs -o rw -d "zpeter2:/var/jboss/log" /zones/zroland3/root/nfsd/zpeter2
share -F nfs -o rw -d "zpeter3:/var/jboss/log" /zones/zroland3/root/nfsd/zpeter3
share -F nfs -o rw -d "zpeter4:/var/jboss/log" /zones/zroland3/root/nfsd/zpeter4
share -F nfs -o rw -d "benchmark2:/var/jboss/log" /zones/zroland3/root/nfsd/benchmark2
(2)make sure the mode of /zones/zroland3/root/nfsd/zpeter2, /zones/zroland3/root/nfsd/zpeter3, /zones/zroland3/root/nfsd/zpeter3 and /zones/zroland3/root/nfs/benchmark2 are 777. So that files can be written in these directories.

(3)restart NFS server

(4)on zone zpeter2, edit /etc/vfstab to include line:
storm:/zones/zroland3/root/nfsd/zpeter2 - /log nfs - yes rw
and do the same thing for zones zpeter3, zpeter4 and benchmark2

(5)restart these zones

No comments:

Post a Comment