Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Oracle Solaris 11 Advanced Administration Cookbook.docx
Скачиваний:
3
Добавлен:
01.07.2025
Размер:
3 Мб
Скачать
☆

Getting ready

This recipe requires a virtual machine (VirtualBox or VMware) that runs Oracle Solaris 11, with 4 GB (minimum) or 8 GB RAM (recommended), an extra disk with 80 GB, and a processor with two or more cores configured for this virtual machine, as shown in the following screenshot that was extracted from my VirtualBox environment:

Chapter 4

How to do it…

To start the procedure, we have to gather all current and relevant information about the system by running the following command:

root@solaris11-1:~#

dladm

show-link

LINK

CLASS

MTU

STATE

OVER

net1

phys

1500

up

--

net0

phys

1500

up

--

root@solaris11-1:~#

ipadm

show-if

IFNAME CLASS

STATE

ACTIVE

OVER

lo0 loopback

ok

yes

--

net0 ip

ok

yes

--

net1 ip

ok

yes

--

root@solaris11-1:~#

ipadm

show-addr

ADDROBJ

TYPE

STATE

ADDR

lo0/v4

static

ok

127.0.0.1/8

net0/v4

static

ok

192.168.1.144/24

net1/v4

static

ok

192.168.5.77/24

lo0/v6

static

ok

::1/128

root@solaris11-1:~# zpool list

NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT myzones 79.5G 544K 79.5G 0% 1.00x ONLINE -

rpool 79.5G 21.2G 58.3G 26% 1.00x ONLINE -

root@solaris11-1:~# zfs list | grep myzones

myzones 494K 78.3G 31K /myzones root@solaris11-1:~#

The system has two network interfaces (net0 and net1), but only net0 will be considered. Additionally, the pool (myzones) has almost 80 GB free space (you can create the myzones pool using zpool create myzones <disk>), and there is no filesystem under it. Then, the first step is to create the pool and one filesystem for each zone (zone1 and zone2) by running the following commands:

root@solaris11-1:~# zpool create myzones c7t2d0 root@solaris11-1:~# zfs create myzones/zone1 root@solaris11-1:~# zfs list myzones/zone1 root@solaris11-1:/myzones# zfs create myzones/zone1 root@solaris11-1:/myzones# zfs create myzones/zone2 root@solaris11-1:/myzones# zfs list | grep zone

Zones

myzones

314K

78.3G

33K

/myzones

myzones/zone1

31K

78.3G

31K

/myzones/zone1

myzones/zone2

31K

78.3G

31K

/myzones/zone2

The storage requirements have been met and now, the next important part of this recipe is to prepare all network infrastructures. To accomplish this task, it will be necessary to create

etherstub (vswitch1) and three VNICs: vnic0 (etherstub), vnic1 (zone1), and vnic2 (zone2). Moreover, we have to connect all VNICs into etherstub (vswitch1). All these tasks are accomplished by executing the following commands:

root@solaris11-1:~# dladm create-etherstub vswitch1

root@solaris11-1:~# dladm show-link

LINK CLASS MTU STATE OVER

net1 phys 1500 up --

net0 phys 1500 up --

vswitch1 etherstub 9000 unknown -- root@solaris11-1:~# dladm create-vnic -l vswitch1 vnic0 root@solaris11-1:~# dladm create-vnic -l vswitch1 vnic1 root@solaris11-1:~# dladm create-vnic -l vswitch1 vnic2 root@solaris11-1:~# dladm show-link

LINK CLASS MTU STATE OVER

net1 phys 1500 up --

net0 phys 1500 up --

vswitch1 etherstub 9000 unknown --

vnic0 vnic 9000 up vswitch1

vnic1 vnic 9000 up vswitch1

LINK

OVER

SPEED

MACADDRESS

MACADDRTYPE

VID

vnic0

vswitch1

40000

2:8:20:d:b:3b

random

0

vnic1

vswitch1

40000

2:8:20:ef:b6:63

random

0

vnic2

vswitch1

40000

2:8:20:ce:b0:da

random

0

vnic2 vnic 9000 up vswitch1 root@solaris11-1:~# dladm show-vnic

Now, it's time to create the first zone (zone1) using ip-type=exclusive (this is the default

value) and vnic1 as a physical network interface:

root@solaris11-1:~# zonecfg -z zone1

Use 'create' to begin configuring a new zone. zonecfg:zone1> create

create: Using system default template 'SYSdefault'

Chapter 4

zonecfg:zone1> set autoboot=true zonecfg:zone1> set zonepath=/myzones/zone1 zonecfg:zone1> add net

zonecfg:zone1:net> set physical=vnic1

zonecfg:zone1:net> end zonecfg:zone1> info zonename: zone1 zonepath: /myzones/zone1 brand: solaris

autoboot: true bootargs:

file-mac-profile: pool:

limitpriv: scheduling-class: ip-type: exclusive hostid:

fs-allowed: net:

address not specified

allowed-address not specified configure-allowed-address: true physical: vnic1

defrouter not specified anet:

linkname: net0 lower-link: auto

allowed-address not specified configure-allowed-address: true defrouter not specified

allowed-dhcp-cids not specified link-protection: mac-nospoof mac-address: random

mac-prefix not specified mac-slot not specified vlan-id not specified

Zones

priority not specified rxrings not specified txrings not specified mtu not specified maxbw not specified rxfanout not specified

vsi-typeid not specified vsi-vers not specified vsi-mgrid not specified etsbw-lcl not specified cos not specified

pkey not specified linkmode not specified

zonecfg:zone1> verify zonecfg:zone1> commit zonecfg:zone1> exit root@solaris11-1:~#

To configure zone2, almost the same steps (the zone info details were omitted) need to be followed by running the following command:

root@solaris11-1:~# zonecfg -z zone2

Use 'create' to begin configuring a new zone. zonecfg:zone2> create

create: Using system default template 'SYSdefault' zonecfg:zone2> set autoboot=true

zonecfg:zone2> set zonepath=/myzones/zone2

zonecfg:zone2> add net zonecfg:zone2:net> set physical=vnic2 zonecfg:zone2:net> end

zonecfg:zone2> verify zonecfg:zone2> commit zonecfg:zone2> exit

Chapter 4

To list the recently configured zones, execute the following command:

root@solaris11-1:~# zoneadm list -cv

ID NAME STATUS PATH BRAND IP

0 global running / solaris shared

  • zone1 configured /myzones/zone1 solaris excl

  • zone2 configured /myzones/zone2 solaris excl

According to the previous recipe, during the first login that happens soon after installing the zone, it is required to provide interactively the system configuration information through eleven screens. To automate and make this simpler, it is feasible to create a system configuration

file for each zone and provide it during each zone installation. To accomplish this task, some information will be asked from it:

For zone1, the information is as follows:

f Computer name: zone1

f Ethernet network configuration: Manually

f Network interface: vnic1

f IP address: 192.168.1.51

f DNS: Do not configure DNS

f Alternate name server: None

f Time zone: (your time zone)

f Date and time: (your current date and time)

f Root password: (your choice)

f Your real name: Alexandre Borges

f Username: aborges1

f Password: hacker123!

f E-mail: anonymous@oracle.com

f Internet access method: No proxy

For zone2, the information is as follows:

f Computer name: zone2

f Ethernet network configuration: Manually

f Network interface: vnic2

f IP address: 192.168.1.52

f DNS: Do not configure DNS

f Alternate name server: None

Zones

f Time zone: (your time zone)

f Date and time: (your current date and time)

f Root password: (your choice)

f Your real name: Alexandre Borges

f Username: aborges2

f Password: hacker123!

f E-mail: anonymous@oracle.com

f Internet access method: No proxy

Create a directory that will hold the zone profiles as follows:

root@solaris11-1:~# mkdir /zone_profiles

Create a profile to zone1 by executing the following command:

root@solaris11-1:~# sysconfig create-profile -o /zone_profiles/zone1.xml

By using the almost the same command, create a profile to zone2 by running the following command:

root@solaris11-1:~# sysconfig create-profile -o /zone_profiles/zone2.xml

To visualize the system configuration content, execute the following command:

root@solaris11-1:~# more /zone_profiles/zone1.xml

<!DOCTYPE service_bundle SYSTEM "/usr/share/lib/xml/dtd/service_bundle. dtd.1">

<service_bundle type="profile" name="sysconfig">

<service version="1" type="service" name="system/config-user">

<instance enabled="true" name="default">

<property_group type="application" name="root_account">

<propval type="astring" name="login" value="root"/>

<propval type="astring" name="password" value="$5$Iabvrv4s$wAqPBN vP7QBZ12ocIdDp/TzNP8Gyv5PBvkTk1QTUEeA"/>

<propval type="astring" name="type" value="role"/>

</property_group>

<property_group type="application" name="user_account">

<propval type="astring" name="login" value="aborges1"/>

<propval type="astring" name="password" value="$5$XfpOXWq9$1roklD SW7LW1Iq0pdpxq5Js16/d4DszHHlZB2AvYRL7"/>

<propval type="astring" name="type" value="normal"/>

<propval type="astring" name="description" value="Alexandre Borges"/>

Chapter 4

<propval type="count" name="gid" value="10"/>

<propval type="astring" name="shell" value="/usr/bin/bash"/>

<propval type="astring" name="roles" value="root"/>

<propval type="astring" name="profiles" value="System Administrator"/>

<propval type="astring" name="sudoers" value="ALL=(ALL) ALL"/>

(truncated output)

Now, it is time to install zone1 and zone2 using their respective system configuration files, as configured previously. Therefore, to perform this task, we'll be using our local repository (as learned in Chapter 1, IPS and Boot Environments) and executing the following command:

root@solaris11-1:~# pkg publisher

PUBLISHER TYPE STATUS P LOCATION

solaris origin online F http://solaris11-1.example.com/ root@solaris11-1:~# zoneadm -z zone1 install -c /zone_profiles/zone1.xml root@solaris11-1:~# zoneadm -z zone2 install -c /zone_profiles/zone2.xml root@solaris11-1:~# zoneadm list -iv

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]