code-test

2016年9月7日 星期三

系統建置開始

設備終於到貨了 今天先確認開機及管理網段的設定 在這邊做個紀錄

2015年10月2日 星期五

使用命令方式新增 node 伺服器

使用命令方式新增 node 伺服器

Adding too much f5 nodes to ltm with one liner

#netscaler.txt

G01        10.1.1.1
P01        10.1.1.2
P02        10.1.1.3
P03        10.1.1.4
F01        10.1.1.5
F02        10.1.1.6
F03        10.1.1.7
F04        10.1.1.8
F05        10.1.1.9
F06        10.1.1.10
F07        10.1.1.11
F08        10.1.1.12
F09        10.1.1.13

etc 2000 lines.


cat netscaler.txt  | while read line; do INF=(echo $line); tmsh create /ltm node ${INF[1]} address ${INF[2]} monitor icmp ; done

取自國外網友

2015年8月29日 星期六

編輯Trunkey Server tomcat


修改index.jsp

vi /var/lib/tomcat6/webapps/ROOT/

    <body bgcolor="pink" >
<body bgcolor="#cccccc">
<body bgcolor="orange">

修改背景顏色
    <body bgcolor="pink" >
        <h1>TurnKey Server 1 Tomcat</h1>

字體加大
    <body bgcolor="pink" >
        <h1><font size="7">TurnKey Server-01 Tomcat</font></h1>


<input type="button" style="background-color:#FFF0D4" value="這是背景顏色為 #FFF0D4 的按鈕"><br>
<input type="button" style="background-color:#FFFF78" value="這是背景顏色為 #FFFF78 的按鈕"><br>
<input type="button" style="background-color:#FFD4D4" value="這是背景顏色為 #FFD4D4 的按鈕"><br>
<input type="button" style="background-color:#C9FFC9" value="這是背景顏色為 #C9FFC9 的按鈕"><br>
<input type="button" style="background-color:#C2C2FF" value="這是背景顏色為 #C2C2FF 的按鈕">


範例效果





#!/bin/bash
# author       oscarwu
# date         2015-08-30
# description  備份設定 檢查
# != 不等於
    echo "check crontab  job "

    if [[ `grep "backup_config.sh" /etc/crontab` = "" ]];then
echo "00 5 * * * /sbin/backup_config.sh" >> /etc/crontab
echo -e "\n\e[1;36m check add script ... OK! \e[0m"
   else
        echo -e "\n\e[1;36m no add crontab backup_config.sh root ... OK! \e[0m"
fi


2015年8月25日 星期二

shell script 檢查目錄,沒有目錄並建立

#!/bin/sh
#shell判斷檔,目錄是否存在或者具有許可權
Path="/var/log/httpd/"
File="/var/log/httpd/access.log"

#這裡的-x 參數判斷$Path是否存在並且是否具有可執行許可權
if [ ! -x "$Path"]; then
mkdir "$Path"
fi

#這裡的-d 參數判斷$Path是否存在
if [ ! -d "$Path"]; then
mkdir "$Path"
fi

#這裡的-f參數判斷$File是否存在
if [ ! -f "$File" ]; then
touch "$File"
echo "檢查資料檔案不存在已建立"
fi

#其他參數還有-n,-n是判斷一個變數是否是否有值
if [ ! -n "$Var" ]; then
echo "$Var is empty"
exit 0
fi

#兩個變數判斷是否相等
if [ "$var1" = "$var2" ]; then
echo '$var1 eq $var2'
else
echo '$var1 not eq $var2'
fi

echo "程式繼續...."

/etc/crontab 內容
10 0 * * * root /usr/sbin/ntpdate time.stdtime.gov.tw; /usr/sbin/hwclock -w
40 5 * * * root yum -y update && yum clean packages

2015年6月4日 星期四

2015年5月3日 星期日

Juniper SRX reinstall or update

使用Juniper junos 作業系統要更新版本有幾種方試
 1.將Juniper SRX 開機當看到下列文字時按Space
loading /boot/defaults/loader.conf

2014年12月1日 星期一

big-ip F5 irule


怕健忘 紀錄irule

LC 常用
when CLIENT_ACCEPTED {
if { [class match [IP::client_addr] equals "Server1"]} {
                 snatpool snat_proxy1
                 pool GW_ISP1_Pool
} elseif {[class match [IP::client_addr] equals "Server2"]} {
                 snatpool snat_proxy2
                 pool GW_ISP2_Pool
 }else {
                   snatpool Default
                   pool gateway_pool
        }
}

when CLIENT_ACCEPTED {
switch [IP::client_addr] {
"10.10.10.10" { snat 192.169.42.10 }
"10.10.10.11" { snat 192.168.42.11 }
"10.10.10.12" { snat 192.168.42.12 }
"10.10.10.13" { snat 192.168.42.13 }
    default { snat automap }
  }
}
when SERVER_CONNECTED {
log local0. "client [IP::client_addr]:[TCP::client_port] snat [IP::local_addr]:[TCP::local_port] server [IP::server_addr]:[TCP::server_port]"
}
}

when CLIENTED_ACCEPTED {
    switch [IP::client_addr] {
        "10.10.10.10" { 
            log local0. "Snatting 10.10.10.10 to 192.168.42.10"
            snat 192.169.42.10 
        }
        "10.10.10.11" { 
            log local0. "Snatting 10.10.10.11 to 192.168.42.11"
            snat 192.168.42.11 
        }
        "10.10.10.12" { 
            log local0. "Snatting 10.10.10.12 to 192.168.42.12"
            snat 192.168.42.12 
        }
        "10.10.10.13" { 
            log local0. "Snatting 10.10.10.13 to 192.168.42.13"
            snat 192.168.42.13 
        }
        default { 
            log local0. "Snatting [IP::client_addr] to automap"
            snat automap 
        }
    }
}


session persistence  in irule
when HTTP_REQUEST { 
if { [HTTP::cookie exists "JSESSIONID"] } { 
persist uie [HTTP::cookie "JSESSIONID"] 1800 
} else { 
set jsess [findstr [HTTP::uri] "JSESSIONID" 11 ";"] 
if { $jsess != "" } { 
persist uie $jsess 1800
when HTTP_RESPONSE { 
if { [HTTP::cookie exists "JSESSIONID"] } { 
persist add uie [HTTP::cookie "JSESSIONID"] 1800 
}


when HTTP_REQUEST { 
# Check if there is a JSESSIONID cookie 
if {[HTTP::cookie "JSESSIONID"] ne ""}{ 
# Persist off of the cookie value with a timeout of 2 hours (7200 seconds) 
persist uie [string tolower [HTTP::cookie "JSESSIONID"]] 7200 
# Log that we're using the cookie value for persistence and the persistence key if it exists. 
log local0. "[IP::client_addr]:[TCP::client_port]: Request to [HTTP::uri] on server [LB::server] with cookie: [HTTP::cookie value JSESSIONID]" 
} else { 
# Parse the jsessionid from the path 
set jsess [findstr [string tolower [HTTP::path]] "jsessionid=" 11] 
# Use the jsessionid from the path for persisting with a timeout of 2 hours (7200 seconds) 
if { $jsess != "" } { 
persist uie $jsess 7200 
# Log that we're using the path jessionid for persistence and the persistence key if it exists. 
log local0. "[IP::client_addr]:[TCP::client_port]: Request to [HTTP::uri] on server [LB::server] used persistence record from path: [persist lookup uie $jsess]" 
when HTTP_RESPONSE { 
# Check if there is a jsessionid cookie in the response 
if {[HTTP::cookie "JSESSIONID"] ne ""} { 
# Persist off of the cookie value with a timeout of 2 hours (7200 seconds) 
persist add uie [string tolower [HTTP::cookie "JSESSIONID"]] 7200 
            # Log Response
log local0. "[IP::client_addr]:[TCP::client_port]: Request to server [LB::server] with cookie: [HTTP::cookie value JSESSIONID]. Added persistence record from cookie: [persist lookup uie [string tolower [HTTP::cookie "JSESSIONID"]]]" 
}
when LB_SELECTED { 
log "From [IP::client_addr] to physical server [LB::server] the cookie JSESSIONID is [HTTP::cookie "JSESSIONID"] URI JESSIONID is [findstr [string tolower [HTTP::path]] "jsessionid=" 11] " 
}

2014年4月30日 星期三

如何使用CLI 設定 F5 root/admin 的密碼?

如何使用CLI 設定 F5 root/admin 的密碼?

# tmsh
 
(tmos)# modify auth password root

changing password for root
new password:
confirm password: 
(tmos)# 


(tmsh0) # modify auth password admin

changing password for admin
new password:
confirm password: 
(tmos)#

如果不能登入F5 忘記密碼 如何做  Password Recovery ?
1) Reboot using front panel keys
2) Following this link to boot into single user mode https://support.f5.com/kb/en-us/solutions/public/4000/100/sol4178.html
3) Do the following
sh-3.2# passwd
Changing password for user root.
New BIG-IP password: 
Retype new BIG-IP password: 
Changing password for user root.
passwd: all authentication tokens updated successfully.
sh-3.2# reboot
INIT: Sending processes the TERM signal
 

2014年4月6日 星期日

F5 執行 .pl 異常 出現 /usr/bin/perl^M: bad interpreter: No such file or directory

F5 執行 .pl  異常/bin/sh^M: bad interpreter: No such file or directory

 出處 :http://eeepage.info/binshm-bad-interpreter-no-such-file-or-directory/

在Linux中執行.sh腳本
異常/bin/sh^M: bad interpreter: No such file or directory

分析:
這是不同系統編碼格式引起的:在windows系統中編輯的.sh文件可能有不可見字符,所以在Linux系統下執行會報以上異常信息。

解決:

1)在windows下轉換:
利用一些編輯器如UltraEdit或EditPlus等工具先將腳本編碼轉換,再放到Linux中執行。
轉換方式如下(UltraEdit):File-->Conversions-->DOS->UNIX即可

2)也可在Linux中轉換:
首先要確保文件有可執行權限
chmod a+x filename

 

然後修改文件格式
vi filename

利用如下命令查看文件格式
:set ff 或 :set fileformat

可以看到如下信息
fileformat=dos 或 fileformat=unix

利用如下命令修改文件格式
:set ff=unix 或 :set fileformat=unix

:wq (存檔退出)

最後再執行文件
./filename

將Terminal 的session儲存log

Save all of your Terminal activity to a file UNIX
I use Terminal everyday, and I find it a good idea to log everything I you. It makes it much easier to undo your mistakes when you know what those mistakes were. Here's how I do this: 

Open Terminal's preferences. 

Go to Settings, then Shell. You can choose here to run a command at startup. You could create a simple log of your session using the following:
/usr/bin/script ~/Desktop/Terminal.log
This will log everything you do and append it to the log file. 

I like to keep my history so instead I wrote this small script that archives previous sessions by renaming the file with a date/time string. I then set Terminal.app to run at startup the following command:
~/Desktop/logger.sh
Here's the script:
#!/bin/bash 
# logger.sh 
# Log everything you do in Terminal. 
 
#* Formatted date & time string. 
FORMATTED_DATE=`/bin/date "+%Y-%m-%d%H%M%S"` 
 
#* Archive the previous file 
/bin/cp -f ~/Desktop/Terminal.log{,.&#36;FORMATTED_DATE.txt} 
 
#* Begin a new one 
/usr/bin/script ~/Desktop/Terminal.log
 
[kirkmc adds: This is a good idea. I don't use Terminal a lot, but I find that I sometimes need to remember a command I ran in the past which is no longer in my history. 

Also, this is similar to something I do with texts I write. I do most of my writing in BBEdit, and I have a number of "scratch" files which I change every year. For example, I have one file for most of what I write, another just for Mac OS X Hints, and another for a specific client I write for. I archive these files at the end of the year, and create new ones. If I ever need to go back to these files to look for something I can do so. I don't bother to enter dates - which I could do easily enough with a TypeIt4Me shortcut - but if I'm looking for something I'll generally know what text to search for.]

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.