code-test

2013年10月3日 星期四

備份自己 FreeBSD system configuration(系統檔案)使用 tar 指令.


備份自己 FreeBSD system configuration(系統檔案).

I set up a simple script to create a configuration backups of my FreeBSD box and I thought I would share it. Note that this script will only back up the /etc and /usr/local/etc directories and weighs in at just under 1MB per backup.

First create a backup script as we can't execute our complex command directly in cron.  You may want to customize the exclude options to your licking, the two listed exclusions are the rather large gconf defaults, witch is not needed, and the working files for transmission.
[root@FB91lab02 /home]#vi /usr/local/sbin/backup-config
貼上下面的內容
bash -c 'tar -Pczf /root/freebsd-cfg-`date "+%Y-%m-%d"`.tgz --exclude={etc/gconf,usr/local/etc/transmission/home/{resume,torrents,Downloads,blocklists}} /etc/ /usr/local/etc/'

Now make it executable.
chmod +x /usr/local/sbin/backup-config

Now add the job to cron and set it to run weekly as root.
修改 cron job
[root@FB91lab02 /home]#vi /etc/crontab

每周備份
# Backup the entire server configuration once a week.
0 1 * * 0 root backup-config 2>/dev/null



tar備份打包時,預設為相對路徑;而排除匹配式預設也是全路徑匹配的所以,在打包時,會提示:“tar: Removing leading `/ from member names”除非你使用-P參數或特定的參數指定。 
它是tar命令為了避免不必要的錯誤而做的限制。如果使用者在壓縮檔時使用了絕對路徑,那麼tar會自動的剝離掉第一個‘/’。 
例如,你想備份/etc的內容: 
$tar -zcvf etc.gz /etc 
生成了一個壓縮包,那麼在解壓這個壓縮包的時候,內容會被寫入到/etc這個目錄,可能潛在的造成風險。 
經過tar剝離第一個’/’後,解壓時壓縮包的內容會被釋放到目前的目錄,即:./etc 
如果非要使用絕對路徑,那麼請加-P參數(解壓縮時也需要加上這個參數)。 
如果想蓋面解壓縮目錄,請加-C參數。

以上取至於網路 如有冒犯 請來信告知  oscarnetwu@gmail.com   

netapp 進階模式

netapp 進階模式

今天設定 netapp 進階模式 順便紀錄一下


filer> priv set advanced
Warning: These advanced commands are potentially dangerous; use
         them only when directed to do so by NetApp
         personnel.
filer*>

options min_spare_count 0

priv set advanced

options raid.min_spare_count 0





下如過要離開的話很簡單 只要執行一下 這個指令

filer*> priv set

filer>

2013年10月2日 星期三

框架設定

框架設定

以上資訊 都取自於網路 如有冒犯 請來信告知 oscarnetwu@gmail.com 謝謝!

STEP1:【框架概念】
  1. 框架的設定是跟其他的HTML標籤太一樣。他的用法是在一個網頁上擺上數個網頁。我的首頁就是一個例子。
    現在你假裝想像一個frame是你整個螢幕的大小, 而 frame 的標籤就是把整個螢幕分成許多部分。
  2. 接下來, 讓我來看右邊這張圖。 框架說明圖
    ??右邊那個 index.html 是什麼啊? 在右邊這張圖, 我們用 index.html 這個網頁把其他 a.html, b.html, 和 c.html 三個網頁呈現在index.html這網頁上。簡單來說, 就是我們需要多個網頁來作一個有數個框架的網頁。
  3. 大概知道框架的概念了吧? 我們要幾個框架, 就需要多少個 HTML 網頁就是了。接下來是語法講解...。


2013年9月16日 星期一

NetApp cifs 搬遷 (舊有CIFS檔案系統升級到N2220 )

最近接到一個 NAS升級案 發現 robocopy 無法將系統權限套用

可以使用fastcopy 是看看 這樣可以減少很多檔案權限設定的問題

強烈建議 搬遷檔案要使用 administrator 比較不會有問題



2013年6月12日 星期三

windows BAT 累加數字

設定累加
set count=0

:Again

rem Do something here....

timeout /t 10

set /a count=count+1


if not "%count%"=="30" goto Again

2013年6月4日 星期二

安裝Novell Suse eDirectory

 

新增設定 OES 服務

Adding/Configuring OES Services on an Existing Server

IMPORTANT:If you are not using the administrator account that originally installed the OES server you are adding services to, see Section 2.4, Installing and Configuring OES as a Subcontainer Administrator and then follow the instructions in Section 4.3, Adding/Configuring OES Services on a Server That Another Administrator Installed.

2013年6月2日 星期日

測試文章

測試文章

測試文章

tsest
測試文章
   
   

Network Management

很棒的netapp 網路設定


轉貼的


Network Management


Your storage system supports physical network interfaces, such as Ethernet and Gigabit Ethernet interfaces, and virtual network interfaces, such as interface group and virtual local area network (VLAN). Each of these network interface types has its own naming convention.


Your storage system supports the following types of physical network interfaces:



  • 10/100/1000 Ethernet

  • Gigabit Ethernet (GbE)

  • 10 Gigabit Ethernet


In addition, some storage system models include a physical network interface named e0M. The e0M interface is used only for Data ONTAP management activities, such as for running a Telnet, SSH, or RSH session. The following table lists interface types, interface name formats, and example of names that use these


identifiers.






























Interface TypeInterface Name FormatExample
Physical interface on a single-port adapter or slote<slot_number>e0


e1
Physical interface on a multiple-port adapter or slote<slot_number><port_letter>e0a


e0b


e1a


e1b
Interface groupAny user-specified string that meets certain criteriaweb_ifgrp


ifgrp1
VLAN<physical_interface_name>-<vlan-ID> or


<ifgrp_name>-<vlan_ID>
e8-2


ifgrp1-3

Beginning with Data ONTAP 7.3, storage systems can accommodate from 256 to 1,024 network interfaces per system, depending on the storage system model, system memory, and whether they are in an HA pair. Each storage system can support up to 16 interface groups. The maximum number of VLANs that can be supported equals the maximum number of network interfaces shown in the following table minus the total number of physical interfaces, interface groups, vh, and loopback interfaces supported by the storage system.


You can manage your storage system locally from an Ethernet connection by using any network interface. However, to manage your storage system remotely, the system should have a Remote LAN Module (RLM) or Baseboard Management Controller (BMC). These provide remote platform management capabilities, including remote access, monitoring, troubleshooting, and alerting features.


Jumbo frames are larger than standard frames and require fewer frames. Therefore, you can reduce the CPU processing overhead by using jumbo frames with your network interfaces. Particularly, by using jumbo frames with a Gigabit or 10 Gigabit Ethernet infrastructure, you can significantly improve performance,depending on the network traffic. Jumbo frames are packets that are longer than the standard Ethernet (IEEE 802.3) frame size of 1,518 bytes. The frame size definition for jumbo frames is vendor-specific because jumbo frames are not part of the IEEE standard. The most commonly used jumbo frame size is 9,018 bytes. Jumbo frames can be used for all Gigabit and 10 Gigabit Ethernet interfaces that are supported on your storage system. The interfaces must be operating at or above 1,000 Mbps. You can set up jumbo frames on your storage system in the following two ways:



  • During initial setup, the setup command prompts you to configure jumbo frames if you have an interface that supports jumbo frames on your storage system.



  • If your system is already running, you can enable jumbo frames by setting the MTU size on an interface.


You can configure IP addresses for your network interface during system setup. To configure the IP addresses later, you should use the ifconfig command.

























































Displayifconfig -a


ifconfig <interface>
IP addressifconfig e0 <IP Address>


ifconfig e0a <IP Address>




# Remove a IP Address


ifconfig e3 0
subnet maskifconfig e0a netmask <subnet mask address>
broadcastifconfig e0a broadcast <broadcast address>
media typeifconfig e0a mediatype 100tx-fd
maximum transmission unit (MTU)ifconfig e8 mtusize 9000
Flow control

ifconfig <interface_name> <flowcontrol> <value>




# example


ifconfig e8 flowcontrol none


Note: value is the flow control type. You can specify the following values for the flowcontrol option:




none - No flow control


receive - Able to receive flow control frames


send - Able to send flow control frames


full - Able to send and receive flow control frames




The default flowcontrol type is full.


trustedifconfig e8 untrusted




Note: You can specify whether a network interface is trustworthy or untrustworthy. When you specify an interface as untrusted (untrustworthy), any packets received on the interface are likely to be dropped.
HA Pair

ifconfig e8 partner <IP Address>




## You must enable takeover on interface failures by entering the following commands:


options cf.takeover.on_network_interface_failure enable


ifconfig interface_name {nfo|-nfo}


nfo - Enables negotiated failover


-nfo - Disables negotiated failover


Note: In an HA pair, you can assign a partner IP address to a network interface. The network interface takes over this IP address when a failover occurs


Alias# Create alias


ifconfig e0 alias 192.0.2.30




# Remove alias


ifconfig e0 -alias 192.0.2.30
Block/Unblock protocols# Block


options interface.blocked.cifs e9


options interface.blocked.cifs e0a,e0b




# Unblock


options interface.blocked.cifs ""
Statsifstat


netstat




Note: there are many options to both these commands so I will leave to the man pages
bring up/down an interfaceifconfig <interface> up


ifconfig <interface> down

Routing


You can have Data ONTAP route its own outbound packets to network interfaces. Although your storage system can have multiple network interfaces, it does not function as a router. However, it can route its outbound packets.




Data ONTAP uses two routing mechanisms:



  • Fast path Data ONTAP uses this mechanism to route NFS packets over UDP and to route all TCP traffic.



  • Routing table To route IP traffic that does not use fast path, Data ONTAP uses the information available in the local routing table. The routing table contains the routes that have been established and are currently in use, as well as the default route specification.


Fast path is an alternative routing mechanism to the routing table, in which the responses to incoming network traffic are sent back by using the same interface as the incoming traffic. It provides advantages such as load balancing between multiple network interfaces and improved storage system performance. Fast path is enabled automatically on your storage system; however, you can disable it. Using fast path provides the following advantages:



  • Load balancing between multiple network interfaces on the same subnet. Load balancing is achieved by sending responses on the same interface of your storage system that receives the incoming requests.



  • Increased storage system performance by skipping routing table lookups.


You can manage the routing table automatically by using the routed daemon, or manually by using the route command. The routed daemon performs the following functions by default:



  • Deletes redirected routes after a specified period

  • Performs router discovery with ICMP Router Discovery Protocol (IRDP) This is useful only if there is no static default route.

  • Listens for Routing Information Protocol (RIP) packets

  • Migrates routes to alternate interfaces when multiple interfaces are available on the same subnet


The routed daemon can also be configured to perform the following functions:



  • Control RIP and IRDP behavior

  • Generate RIP response messages that update a host route on your storage system

  • Recognize distant gateways identified in the /etc/gateways file


If you are firmiliar with Unix routing then you should have no trouble with the following routing commands:

























default route# using wrfile and rdfile edit the /etc/rc file with the below


route add default 192.168.0.254 1




# the full /etc/rc file will look like something below


hostname netapp1


ifconfig e0 192.168.0.10 netmask 255.255.255.0 mediatype 100tx-fd


route add default 192.168.0.254 1


routed on
enable/disable fast pathoptions ip.fastpath.enable {on|off}




Note:


on - Enables fast path


off - Disables fast path
enable/disable routing daemonrouted {on|off}




Note:


on - Turns on the routed daemon


off - Turns off the routed daemon
Display routing tablenetstat -rn


route -s


routed status

Add to routing table


route add 192.168.0.15 gateway.com 1

Hosts and DNS


Hosts and DNS are the same as Unix but here is a quick table just to jog your memory

































Hosts

# use wrfile and rdfile to read and edit /etc/hosts file , it basically use the sdame rules as a Unix


# hosts file


nsswitch file

# use wrfile and rdfile to read and edit /etc/nsswitch.conf file , it basically uses the same rules as a


# Unix nsswitch.conf file


DNS# use wrfile and rdfile to read and edit /etc/resolv.conf file , it basically uses the same rules as a


# Unix resolv.conf file




options dns.enable {on|off}




Note:


on - Enables DNS


off - Disables DNS
Domain Nameoptions dns.domainname <domain>
DNS cacheoptions dns.cache.enable


options dns.cache.disable




# To flush the DNS cache


dns flush




# To see dns cache information


dns info
DNS updates

options dns.update.enable {on|off|secure}


Note:


on - Enables dynamic DNS updates


off - Disables dynamic DNS updates


secure - Enables secure dynamic DNS updates


time-to-live (TTL)

options dns.update.ttl <time>


# Example


options dns.update.ttl 2h




Note: time can be set in seconds (s), minutes (m), or hours (h), with a minimum value of 600 seconds


and a maximum value of 24 hour



I will leave you to read the documentation regarding how to configure NIS.


VLAN


This section is a breif introduction into VLANs. VLANs provide logical segmentation of networks by creating separate broadcast domains. A VLAN can span multiple physical network segments. The end-stations belonging to a VLAN are related by function or application. For example, end-stations in a VLAN might be grouped by departments, such as engineering and accounting, or by projects, such as release1 and release2. Because physical proximity of the endstations is not essential in a VLAN, you can disperse the end-stations geographically and still contain the broadcast domain in a switched network.


An end-station must become a member of a VLAN before it can share the broadcast domain with other end-stations on that VLAN. The switch ports can be configured to belong to one or more VLANs (static registration), or end-stations can register their VLAN membership dynamically, with VLAN-aware switches. VLAN membership can be based on one of the following:



  • Switch ports

  • End-station MAC addresses

  • Protocol


In Data ONTAP, VLAN membership is based on switch ports. With port-based VLANs, ports on the same or different switches can be grouped to create a VLAN. As a result, multiple VLANs can exist on a single switch.


Any broadcast or multicast packets originating from a member of a VLAN are confined only among the members of that VLAN. Communication between VLANs, therefore, must go through a router. The following figure illustrates how communication occurs between geographically dispersed VLAN members.



In this figure, VLAN 10 (Engineering), VLAN 20 (Marketing), and VLAN 30 (Finance) span three floors of a building. If a member of VLAN 10 on Floor 1 wants to communicate with a member of VLAN 10 on Floor 3, the communication occurs without going through the router, and packet flooding is limited to port 1 of Switch 2 and Switch 3 even if the destination MAC address to Switch 2 and Switch 3 is not known.


GARP VLAN Registration Protocol (GVRP) uses Generic Attribute Registration Protocol (GARP) toallow end-stations on a network to dynamically register their VLAN membership with GVRP-aware switches. Similarly, these switches dynamically register with other GVRP-aware switches on the network, thus creating a VLAN topology across the network. GVRP provides dynamic registration of VLAN membership; therefore, members can be added or removed from a VLAN at any time, saving the overhead of maintaining static VLAN configuration on switch ports. Additionally, VLAN membership information stays current, limiting the broadcast domain of a VLAN only to the active members of that VLAN.


By default, GVRP is disabled on all VLAN interfaces in Data ONTAP; however, you can enable it. After you enable GVRP on an interface, the VLAN interface informs the connecting switch about the VLANs it supports. This information (dynamic registration) is updated periodically. This information is also sent every time an interface comes up after being in the down state or whenever there is a change in the VLAN configuration of the interface.


A VLAN tag is a unique identifier that indicates the VLAN to which a frame belongs. Generally, a VLAN tag is included in the header of every frame sent by an end-station on a VLAN. On receiving a tagged frame, the switch inspects the frame header and, based on the VLAN tag, identifies the VLAN. The switch then forwards the frame to the destination in the identified VLAN. If the destination MAC address is unknown, the switch limits the flooding of the frame to ports that belong to the identified VLAN.


VLANs provide a number of advantages such as ease of administration, confinement of broadcast domains, reduced network traffic, and enforcement of security policies.

























Create

vlan create [-g {on|off}] ifname vlanid




# Create VLANs with identifiers 10, 20, and 30 on the interface e4 of a storage system by using the following command:


vlan create e4 10 20 30


# Configure the VLAN interface e4-10 by using the following command


ifconfig e4-10 192.168.0.11 netmask 255.255.255.0


Addvlan add e4 40 50
Delete# Delete specific VLAN


vlan delete e4 30




# Delete All VLANs on a interface


vlan delete e4
Enable/Disable GRVP on VLANvlan modify -g {on|off} ifname
Statvlan stat <interface_name> <vlan_id>




# Examples


vlan stat e4


vlan stat e4 10

Interface Groups


An interface group is a feature in Data ONTAP that implements link aggregation on your storage system. Interface groups provide a mechanism to group together multiple network interfaces (links) into one logical interface (aggregate). After an interface group is created, it is indistinguishable from a physical network interface.


Interface groups provide several advantages over individual network interfaces:



  • Higher throughput Multiple interfaces work as one interface.

  • Fault tolerance If one interface in an interface group goes down, your storage system stays connected to the network by using the other interfaces.

  • No single point of failureIf the physical interfaces in an interface group are connected to multiple switches and a switchgoes down, your storage system stays connected to the network through the other switches.


You can create three different types of interface groups on your storage system: single-mode interface groups, static multimode interface groups, and dynamic multimode interface groups. Each interface group provides different levels of fault tolerance. Multimode interface groups provide methods for load balancing network traffic.


In a single-mode interface group, only one of the interfaces in the interface group is active. The other interfaces are on standby, ready to take over if the active interface fails. All interfaces in a singlemode interface group share a common MAC address. There can be more than one interface on standby in a single-mode interface group. If an active interface fails, your storage system randomly picks one of the standby interfaces to be the next active link. The active link is monitored and link failover is controlled by the storage system; therefore, single-mode interface group does not require any switch configuration. Single-mode interface groups also do not require a switch that supports link aggregation.


Dynamic multimode interface groups can detect not only the loss of link status (as do static multimode interface groups), but also a loss of data flow. This feature makes dynamic multimode interface groups compatible with high-availability environments. The dynamic multimode interface group implementation in Data ONTAP is in compliance with IEEE 802.3ad (dynamic), also known as Link Aggregation Control Protocol (LACP). Dynamic multimode interface groups have some special requirements. They include the following:



  • Dynamic multimode interface groups must be connected to a switch that supports LACP.

  • Dynamic multimode interface groups must be configured as first-level interface groups.

  • Dynamic multimode interface groups should be configured to use the IP-based load-balancing method.


In a dynamic multimode interface group, all interfaces in the interface group are active and share a single MAC address. This logical aggregation of interfaces provides higher throughput than a singlemode interface group. A dynamic multimode interface group requires a switch that supports link aggregation over multiple switch ports. The switch is configured so that all ports to which links of an interface group are connected are part of a single logical port. For information about configuring the switch, see your switch vendor's documentation. Some switches might not support link aggregation of ports configured for jumbo frames.


The load-balancing method for a multimode interface group can be specified only when the interface group is created. If no method is specified, the IP address based load-balancing method is used.

















































Create (single-mode)

# To create a single-mode interface group, enter the following command:


ifgrp create single SingleTrunk1 e0 e1 e2 e3


# To configure an IP address of 192.168.0.10 and a netmask of 255.255.255.0 on the singlemode interface group SingleTrunk1


ifconfig SingleTrunk1 192.168.0.10 netmask 255.255.255.0


# To specify the interface e1 as preferred


ifgrp favor e1


Create ( multi-mode)

# To create a static multimode interface group, comprising interfaces e0, e1, e2, and e3 and using MAC


# address load balancing


ifgrp create multi MultiTrunk1 -b mac e0 e1 e2 e3


# To create a dynamic multimode interface group, comprising interfaces e0, e1, e2, and e3 and using IP


# address based load balancing


ifgrp create lacp MultiTrunk1 -b ip e0 e1 e2 e3


Create second level intreface group

# To create two interface groups and a second-level interface group. In this example, IP address load


# balancing is used for the multimode interface groups.


ifgrp create multi Firstlev1 e0 e1


ifgrp create multi Firstlev2 e2 e3


ifgrp create single Secondlev Firstlev1 Firstlev2


# To enable failover to a multimode interface group with higher aggregate bandwidth when one or more of


# the links in the active multimode interface group fail


options ifgrp.failover.link_degraded on


Note: You can create a second-level interface group by using two multimode interface groups. Secondlevel interface groups enable you to provide a standby multimode interface group in case the primary multimode interface group fails.


Create second level intreface group in a HA pair# Use the following commands to create a second-level interface group in an HA pair. In this example,


# IP-based load balancing is used for the multimode interface groups.




# On StorageSystem1:


ifgrp create multi Firstlev1 e1 e2


ifgrp create multi Firstlev2 e3 e4


ifgrp create single Secondlev1 Firstlev1 Firstlev2




# On StorageSystem2 :


ifgrp create multi Firstlev3 e5 e6


ifgrp create multi Firstlev4 e7 e8


ifgrp create single Secondlev2 Firstlev3 Firstlev4




# On StorageSystem1:


ifconfig Secondlev1 partner Secondlev2




# On StorageSystem2 :


ifconfig Secondlev2 partner Secondlev1
Favoured/non-favoured interface

# select favoured interface


ifgrp nofavor e3


# select a non-flavoured interface


ifgrp nofavor e3


Addifgrp add MultiTrunk1 e4
Deleteifconfig MultiTrunk1 down


ifgrp delete MultiTrunk1 e4




Note: You must configure the interface group to the down state before you can delete a network interface


from the interface group
Destroy

ifconfig ifgrp_name down


ifgrp destroy ifgrp_name


Note: You must configure the interface group to the down state before you can delete a network interface


from the interface group


Enable/disable a interface groupifconfig ifgrp_name up


ifconfig ifgrp_name down
Statusifgrp status [ifgrp_name]
Statifgrp stat [ifgrp_name] [interval]

Diagnostic Tools


There are a number of tools and options that you can use to help with network related problems
































Useful options

Ping thottling# Throttle ping


options ip.ping_throttle.drop_level <packets_per_second>




# Disable ping throttling


options ip.ping_throttle.drop_level 0
Forged IMCP attacksoptions ip.icmp_ignore_redirect.enable on




Note: You can disable ICMP redirect messages to protect your storage system against forged ICMP redirect attacks.

Useful Commands

netdiagThe netdiag command continuously gathers and analyzes statistics, and performs diagnostic tests. These diagnostic tests identify and report problems with your physical network or transport layers and suggest remedial action.

pingYou can use the ping command to test whether your storage system can reach other hosts on your network.
pkttYou can use the pktt command to trace the packets sent and received in the storage system's network.

2013年5月8日 星期三

【MySQL】變更root 密碼

MySQL Change root Password

【MySQL】MySQL root 密碼 Recover

Recover MySQL root Password

by NIXCRAFT on APRIL 18, 2006 · 249 COMMENTS· LAST UPDATED AUGUST 4, 2010

【Vyatta】netflow 設定

 

vyatta@R1:~$ configure
vyatta@R1# set system flow-accounting netflow version 5
vyatta@R1# set system flow-accounting netflow server 192.168.5.97
vyatta@R1# set system flow-accounting netflow server 192.168.5.97 port 2055
vyatta@R1# commit

vyatta@R1# save

查看 netflow 是否正常

vyatta@R1:~$ show flow-accounting interface eth0
flow-accounting for [eth0]
Src Addr        Dst Addr        Sport Dport Proto    Packets      Bytes   Flows
10.1.0.14       224.0.0.18      0     0      vrrp        233       9320       1
69.59.150.135   10.1.0.90       123   123     udp         12        912       2
76.74.103.45    10.1.0.90       0     0      icmp          2        168       1
10.0.0.30       10.1.0.90       53    40089   udp          1        133       1
10.0.0.30       10.1.0.90       53    36641   udp          1        133       1
10.0.0.30       10.1.0.90       53    51363   udp          1        106       1

Total entries: 6
Total flows  : 7
Total pkts   : 250
Total bytes  : 10,772

打完收工

2013年5月7日 星期二

[VMWare] vmware 使用的port

VMware vCenter Server 系統必須能夠將資料發送到每個受管主機,並且從每個 vSphere Client 接收資料。對於受管主機間的遷移和置備活動,源主機和目標主機必須能夠彼此接收資料。
 
有關 Windows 上的 vCenter Server 所需埠的資訊,請參見vCenter Server 所需的埠。
VMware 使用指定的埠進行通信。此外,受管主機將在指定的埠上監控來自於 vCenter Server 系統的資料。vCenter Server Appliance 已進行了預配置,以使用在vCenter Server Appliance 所需的埠中列出的埠。對於自訂防火牆,必須手動打開所需埠。如果在兩台受管主機之間有防火牆,並且您要在源主機或目標主機上執行活動,例如遷移或克隆,則必須配置一種方式,以便受管主機接收資料。
443 port902 port,443 port主要負責資料訊息的傳遞,而902 port主要負責遠端console畫面的傳遞
vCenter Server Appliance 所需的埠
描述
80 vCenter Server 需要埠 80 用於直接 HTTP 連接。埠 80 會將請求重定向到 HTTPS 埠 443。如果意外使用了 http://server 而不是 https://server,此重定向將非常有用。
443 vCenter Server 系統用於偵聽來自 vSphere Client 的連接的默認埠。要使 vCenter Server 從 vSphere Client 接收資料,請在防火牆中打開 443 埠。
vCenter Server 系統還使用埠 443 監控從 SDK 用戶端傳輸的資料。
如果對 HTTPS 使用另一個埠號,則登錄 vCenter Server 系統時必須使用ip-address:port。
902 vCenter Server 系統用於將資料發送到受管主機的預設埠。受管主機也會通過 UDP 埠 902 定期向 vCenter Server 系統發送檢測信號。伺服器和主機之間或各個主機之間的防火牆不得阻止此埠。
不得在 vSphere Client 和主機之間阻塞埠 902。vSphere Client 使用此埠顯示虛擬機器控制台。
8080 Web 服務 HTTP。用於 VMware VirtualCenter Management WebServices。
8443 Web 服務 HTTPS。用於 VMware VirtualCenter Management WebServices。
10080 vCenter Inventory Service HTTP。
10443 vCenter Inventory Service HTTPS。
10109 vCenter Inventory Service 資料庫。
514 vSphere Syslog Collector 伺服器。
1514 vSphere Syslog Collector 伺服器 (SSL)。
6500 網路 coredump 伺服器 (UDP)。
6501 Auto Deploy 服務。
6502 Auto Deploy 管理。
9090 vSphere Web Client HTTP。
9443 vSphere Web Client HTTPS。
5480 vCenter Server Appliance Web 使用者介面 HTTPS。
5489 vCenter Server Appliance Web 使用者介面 CIM 服務。
22 SSHD 的系統埠。

[Freebsd] DNS架設

Chapter 2 DNS 架設 - 使用 bind 9-9.3. 4.1

Chapter 2-1  安裝 Bind 9-9.2.

實際上的應用,若所有的Services都在一台Server上,是不需要有特定一台的DNS Server的,在此僅以模擬其他Service是在Test Host上為主。(使用BIND 9.X之優點:多執行緒多CPU的支援、多了A6 offset的功能、反解有三種方法,簡單且對IPv6的特性更容易處理、支援多種不同資料庫等等)。

安裝Bind 9-9.2.2以上:

# cd /usr/ports/dns/bind99

make

make install clean

設定 forwarders

forwarders {
        //127.0.0.1;
    168.95.1.1;
};

設定 zone file

 

zone "testlab.com.tw" { // 宣告網域名稱
        type master;
        file "zone.fwd.testlab";
};

// [Rev] 反解網域設定區,
// 宣告反解的IP區段,Class C。
zone "0.1.168.192.in-addr.arpa" {
        type master;
        file "zone.rev";
};

內容為:

更新 /etc/rc.conf檔案

Command: vi /etc/rc.conf

Context:

named_enable="YES" //加入

完成以上步驟後,啟動DNS

Command: /etc/rc.d/named start

2013年5月2日 星期四

【FreeBSD】網路流量統計 RRDTool + Cacti 統計

 

     

RRDtool 是原 MRTG 作者另外開發的套件,它可將系統吐出來的資料做 logging 並繪製成圖表

而系統所吐出來的資料是 based on SNMP ( Simple Network Management Protocol ),所以只要是支援 SNMP 的設備都可以用 RRDtool 來做記錄與分析

不過仔細看了一下 RRDtool 操作的語法算小複雜,因此本篇教學會再搭配 Cacti 來協助控制 RRDtool 繪製報表

我的安裝環境如下

[ 安裝所需套件 ]

首先我們先安裝 RRDtool

# cd /usr/ports/databases/rrdtool
# make install clean

pkg_add -r gobject-introspection

接下來安裝 Net-SNMP

# cd /usr/ports/net-mgmt/net-snmp
# make install clean

[ ] AX_SOCKONLY

[ ] DMALLOC

不選

3 安裝 Cacti

# cd /usr/ports/net-mgmt/cacti
# make install clean

=======================================================================
Cacti is now installed. If you intall it for the first time,
you may have to follow this steps to make it work correctly:

1. Create the MySQL database:
# mysqladmin --user=root create cacti
2. Create a mysql user/password for cacti:
   (change user and/or password if required)
# echo "GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactiuser'; FLUSH PRIVILEGES;" | mysql
3. Import the default cacti database:
# mysql cacti < /usr/local/share/cacti/cacti.sql
4. Edit /usr/local/share/cacti/include/config.php.
5. Add the line to cron jobs with the command:
# crontab -u cacti -e
*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1
6. Add alias in apache config for the cacti dir:
Alias /cacti "/usr/local/share/cacti/"
7. Be sure apache gives an access to the directory ('Allow from' keywords).
8. Open a cacti login page in your web browser and login with admin/admin.

If you update cacti, open a login page, an updating process
will start automatically.
=======================================================================

上述三個套件安裝完之後,就可以開始來設定囉!

[ 設定 SNMP ]

首先先來設定 SNMP 的部份

# cd /usr/local/share/snmp
# vi snmpd.conf

snmpd.conf 內容如下

rocommunity public  // 設定 SNMP Read-Only 的 Community
syslocation MyOffice-at-work  // 系統所在地
syscontact oscarxxx.xxx@gmail.com  // 管理者 E-mail

rocommunity public
syslocation MyOffice-at-work
syscontact oscarxxx.xxx@gmail.com

另外請在 /etc/rc.conf 加入一行 snmpd_enable="YES"

# echo snmpd_enable=”yes” >> /etc/rc.conf

加好了之後就來啟動 SNMP 吧

# /usr/local/etc/rc.d/snmpd start

[ 設定 Cacti ]

設定 Cacti 這部份看個人習慣,如果您已經有 phpMyAdmin 的話可以在裡面操作,或是透過指令方式來新建

原則上我們需要新建一個 Database、User 讓 Cacti 可以存放相關資料

指令操作如下,新增一個 Database 名稱為 cacti

# mysqladmin -u root -p create cacti
Enter password: 輸入 Root 的密碼

新增一個 User 名叫 cacti 讓它可以存取 cacti 這個 Database,密碼設定為 cactiuser

[root@fb91-lab /usr/ports/net-mgmt/cacti]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.5.28-log Source distribution

Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

mysql> GRANT ALL ON cacti.* TO cacti@localhost IDENTIFIED BY 'cactiuser';
Query OK, 0 rows affected (0.02 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye

接下來我們要倒入 Database 相關的 Schema

# mysql -u cacti -p cacti < /usr/local/share/cacti/cacti.sql
Enter password: 以本教學為例輸入 justforcacti

Database 的 Schema 建好之後,接下來我們來去設定程式的部份

# cd /usr/local/share/cacti/include/
# vi /usr/local/share/cacti/include/config.php

config.php 內容如下,原則上要改的地方就只有 username 跟 password 而已

/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cacti";
$database_password = "cactiuser";
$database_port = "3306";
/* Default session name - Session name must contain alpha characters */
#$cacti_session_name = "Cacti";

接下來新增排程設定,固定每 5 分鐘讓 Cacti 去取得資料

# crontab -u cacti -e

加入這一行即可

*/5 * * * * /usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null 2>&1

接下來我們要在 Apache 裡面設定 Cacti 的路徑

# vi /usr/local/etc/apache22/httpd.conf

在 httpd.conf 加入下面這幾行

Alias /cacti "/usr/local/share/cacti/"
<Directory "/usr/local/share/cacti/">
        Options None
        AllowOverride None
        Order allow,deny
        Allow from all
</Directory>

/usr/local/share/cacti/

Allow from 127.0.0.1 192.168.0.0/16 .example.comss

好了之後要重新啟動 Apache 讓它生效

# /usr/local/etc/rc.d/apache22 restart

[ 初始化 Cacti ]

網址列請打入 http://您的 IP or Domain/cacti

FreeBSD 中文字型

# cd /usr/ports/chinese/font-std
# make install clean

Cacti 還有一些外掛 可以使用