Pages

Showing posts with label F5 big-ip. Show all posts
Showing posts with label F5 big-ip. Show all posts

TMSH command on F5 LTM


Help is available on the following topics

General:
  glob                      regex                        tmsh
  grep                      time

Commands:
  cd                        list                         restart
  cp                        load                         run
  create                    modify                       save
  delete                    mv                           send-mail
  edit                      publish                      show
  exit                      pwd                          shutdown
  generate                  quit                         start
  help                      reboot                       stop
  install                   reset-stats                  submit

Modules:
  auth
  cert-ldap                 password-policy              source
  ldap                      radius                       tacacs
  login-failures            radius-server                user
  partition                 remote-role
  password                  remote-user

  cli
  admin-partitions          preference                   version
  global-settings           script
  history                   transaction

  cli alias
  private                   shared

  cm
  cert                      key                          watch-devicegroup-device
  config-sync               sniff-updates                watch-sys-device
  device                    sync-status                  watch-trafficgroup-device
  device-group              traffic-group
  failover-status           trust-domain

  ltm
  default-node-monitor      policy                       snat-translation
  eviction-policy           policy-strategy              snatpool
  ifile                     pool                         traffic-class
  nat                       rule                         virtual
  node                      snat                         virtual-address

  ltm auth
  crldp-server              profile                      ssl-crldp
  kerberos-delegation       radius                       ssl-ocsp
  ldap                      radius-server                tacacs
  ocsp-responder            ssl-cc-ldap

  ltm clientssl
  ocsp-stapling-responses

  ltm clientssl-proxy
  cached-certs

  ltm data-group
  external                  internal

  ltm dns
  dns-express-db            tsig-key
  nameserver                zone

  ltm dns analytics
  global-settings

  ltm dns cache
  global-settings           transparent
  resolver                  validating-resolver

  ltm dns cache records
  key                       nameserver
  msg                       rrset

  ltm dns dnssec
  key                       zone

  ltm global-settings
  connection                general                      traffic-control

  ltm html-rule
  comment-raise-event       tag-prepend-html             tag-remove-attribute
  comment-remove            tag-raise-event
  tag-append-html           tag-remove

  ltm message-routing

  ltm message-routing generic
  peer                      route                        transport-config
  protocol                  router

  ltm message-routing sip
  peer                      route                        transport-config

  ltm message-routing sip profile
  router                    session

  ltm monitor
  diameter                  mssql                        sip
  dns                       mysql                        smb
  external                  nntp                         smtp
  firepass                  none                         snmp-dca
  ftp                       oracle                       snmp-dca-base
  gateway-icmp              pop3                         soap
  http                      postgresql                   tcp
  https                     radius                       tcp-echo
  icmp                      radius-accounting            tcp-half-open
  imap                      real-server                  udp
  inband                    rpc                          virtual-location
  ldap                      sasp                         wap
  module-score              scripted                     wmi

  ltm persistence
  cookie                    msrdp                        ssl
  dest-addr                 persist-records              universal
  global-settings           sip
  hash                      source-addr

  ltm profile
  certificate-authority     http2                        rtsp
  classification            icap                         sctp
  client-ldap               iiop                         server-ldap
  client-ssl                ipother                      server-ssl
  dhcpv4                    mblb                         sip
  dhcpv6                    mssql                        smtps
  diameter                  ntlm                         socks
  dns                       ocsp-stapling-params         spdy
  dns-logging               one-connect                  statistics
  fasthttp                  pptp                         stream
  fastl4                    qoe                          tcp
  fix                       radius                       udp
  ftp                       ramcache                     wa-cache
  gtp                       request-adapt                web-acceleration
  html                      request-log                  xml
  http                      response-adapt
  http-compression          rewrite

  net
  arp                       lldp-neighbors               self-allow
  bwc-policy                ndp                          stp
  cmetrics                  packet-filter                stp-globals
  dns-resolver              packet-filter-trusted        trunk
  ike-evt-stat              port-mirror                  vlan
  ike-msg-stat              route                        vlan-allowed
  interface                 route-domain                 vlan-group
  interface-cos             router-advertisement         wccp
  ipsec-stat                rst-cause
  lldp-globals              self

  net cos
  global-settings           map-dscp
  map-8021p                 traffic-priority

  net fdb
  tunnel                    vlan

  net ipsec
  ike-daemon                ipsec-policy                 traffic-selector
  ike-peer                  ipsec-sa
  ike-sa                    manual-security-association

  net rate-shaping
  class                     queue
  drop-policy               shaping-policy

  net tunnels
  etherip                   ipsec                        v6rd
  fec                       map                          vxlan
  fec-stat                  ppp                          wccp
  gre                       tcp-forward
  ipip                      tunnel

  sys
  classification-signature  ha-status                    outbound-smtp
  clock                     hardware                     pptp-call-info
  cluster                   host-info                    proc-info
  config                    httpd                        provision
  config-diff               hypervisor-info              pva-traffic
  connection                icmp-stat                    scriptd
  console                   ip-address                   service
  cpu                       ip-stat                      smtp-server
  daemon-ha                 iprep-status                 snmp
  datastor                  license                      sshd
  db                        log                          state-mirroring
  dns                       log-rotate                   sync-sys-files
  failover                  mac-address                  syslog
  feature-module            management-dhcp              tmm-info
  fix-connection            management-ip                tmm-traffic
  folder                    management-route             traffic
  geoip                     mcp-state                    ucs
  global-settings           memory                       version
  ha-group                  ntp

  sys application
  apl-script                service
  custom-stat               template

  sys crypto
  cert                      crl                          pkcs12
  check-cert                key                          server
  client                    master-key

  sys crypto fips
  by-handle                 external-hsm                 key

  sys daemon-log-settings
  clusterd                  icrd                         mcpd
  csyncd                    lind                         tmm

  sys disk
  application-volume        directory                    logical-disk

  sys file
  apache-ssl-cert           ifile                        system-ssl-cert
  dashboard-viewset         ssl-cert                     system-ssl-key
  data-group                ssl-crl
  external-monitor          ssl-key

  sys fpga
  firmware-config           info

  sys icall
  event                     publisher
  istats-trigger            script

  sys icall handler
  periodic                  perpetual                    triggered

  sys ipfix
  destination               element                      irules

  sys log-config
  filter                    publisher

  sys log-config destination
  alertd                    local-database               remote-syslog
  arcsight                  local-syslog                 splunk
  ipfix                     remote-high-speed-log

  sys performance
  all-stats                 ramcache                     throughput
  connections               system

  sys raid
  array                     bay                          disk

  sys sflow
  receiver

  sys sflow data-source
  http                      system
  interface                 vlan

  sys sflow global-settings
  http                      system
  interface                 vlan

  sys software
  block-device-hotfix       image                        update
  block-device-image        signature                    update-status
  hotfix                    status                       volume

  sys url-db
  download-result           download-schedule            url-category

  util
  bash                      ping                         test-monitor
  ccmode                    ping6                        tracepath
  dig                       platform_check               tracepath6
  dnat                      qkview                       traceroute
  domain-tool               racoonctl                    traceroute6
  fips-card-sync            scp                          unix-ls
  fips-util                 sftp                         unix-mv
  gencert                   sipdb                        unix-rm
  get-ccn-dossier           ssh-keyswap                  updatecheck
  get-dossier               ssldump                      vconsole
  imish                     sys-icheck                   zebos
  lsndb                     tcpdump
  netstat                   telnet

  wom

  wom profile

iRule select Pool on F5 big-ip

when HTTP_REQUEST {
    switch -glob [string tolower [HTTP::host]] {
     
        "abc*.com.vn" { pool Pool_01 }
     
        "xyz*.com.vn" { pool Pool_02}

.......


    }      
}



Select pool when check destination port of client

when CLIENT_ACCEPTED {
    if {([TCP::local_port] >= 2223)
    && ([TCP::local_port] <= 2230) } {
      pool Web01_range
    } else reject
}

iRule redirect from HTTP to HTTPs on F5 big-ip


when HTTP_REQUEST {
       HTTP::redirect "https://[HTTP::host][HTTP::uri]"
    }

-------------------------------------------------------------------------------------------------------
Another example of redirection from http to https when it is conditional

when HTTP_REQUEST {
   set host [string tolower [HTTP::host]]
   if { ($host ends_with ".abc.com") && !($host starts_with "admin") } {
        HTTP::redirect "https://[HTTP::host][HTTP::uri]"  }
   

}

reading .ucs archive

 ucs file is a gzip compressed tar archive. You can extract it on the BIG-IP using tar: 

mkdir /var/tmp/ucs_extract 
cd /var/tmp/ucs_extract 
cp /path/to/your.ucs /var/tmp/ucs_extract/ 
tar xvfz your.ucs 

Else, you can copy it to a workstation and use a standard zip archive utility like WinRAR or WinZIP to open and view the files. 

Here are a few related solutions: 

SOL4423: Overview of UCS archives (Click here) 

SOL8465: Viewing and extracting the contents of an encrypted UCS archive file (Click here) 

How to auto backup configure F5 Big-ip by script

1. Tạo file backup.sh
#!/bin/bash
#Name: backup.sh
# BIG-IP Backup Script
# This script automates LTM v13 Backups and saves the files with hostname and date
# off to an FTP server
# version 1.0
# Author: thudv
# Original Date: 25/06/17
export a=`date +%y%m%d`

#rm -f /var/local/ucs/F5*

export aa=$HOSTNAME.$a.ucs
tmsh save sys ucs $aa
export file_ucs=/var/local/ucs/$aa

find /var/local/ucs/F5* -type f -mtime +7 -print
find /var/local/ucs/F5*  -type f -mtime +7 -delete

ftp -n -v  ftp_server << EOT
user username_ftp password_ftp
binary
put $file_ucs $aa

bye
EOT

2. Chmod 755 backup.sh
3. Cấu hình crontab
 crontab -e
edit: 30 23 * * * /bin/sh /home/thudv/backup.sh >/dev/null

Chú ý: Khi nâng cấp OS vào 1 phân vùng mới thì cần cấu hình lại crontab

iRule Maintenance for F5


when HTTP_REQUEST {
    if {[active_members [LB::server pool]] < 1} {  
    HTTP::respond 200 content "<html>
<head>
<title>iLab - Sever Updating...</title>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8' />
<meta http-equiv='refresh' content='60'>
</head>
<body><h1>Nâng cấp hệ thống</h1>
Để nâng cao chất lượng dịch vụ, nhóm phần mềm đang tiến hành nâng cấp hệ thống.<br />
Xin bạn vui lòng đợi trong giây lát và truy cập lại sau. <br />
Trân trọng!
</body></html>"
    }
}

F5 Big-ip

Profiles on F5 Big-ip


Dùng để thay đổi luồng traffic mặc định thông qua 1 VS cụ thể.

1. Persistence

Dùng để cấu hình cho Virtual Server
Khi có 1 kết nối tới 1 server thì nó sẽ giữ session này cho hết thời gian timeout, và chỉ chuyển các gói tin của client này đến server đó, vì nếu chuyển đến server khác thì gói tin sẽ bị drop.

Nếu nhiều client được NAT trước khi đến VS thì tất cả các request sẽ dc gửi tới 1 pool number. Vì vậy, nếu 1 lượng lớn request của nhóm này gửi đến thì việc phân phối request trên các pool Number sẽ ko đồng đều.

1.1. Source Address Persistence (SAP)

Nếu các client cùng 1 source sẽ được lưu vào persistence record và được đẩy request tới cùng 1 pool number. Có thể dùng netmask là /24 hoặc /32.

==>sử dụng cách này thì F5 sẽ có 1 lượng lớn dư liệu cần xử lý trong persistence record.

1.2. Cookie Persistence (CP)

Khi muốn add thêm các clients trong internal vào Persistence Profile thì sẽ xảy ra nghẽn cục bộ. vì tất cả các internal clients thuộc nhiều subnet /24 khác nhau sẽ match cùng 1 persistence record (NAT ra cùng 1 ip public???) --> sử dụng cùng 1 pool member =>nghẽn.
Sử dụng  SAP trong trường hợp này sẽ dẫn đến tải không đồng đều khi traffic thông qua trên 10 pool member khác nhau.
==> sử dụng CP giúp giải quyết vấn đề  xử lý client internal từ những ứng dụng của họ là http hay web-based.
Có 3 modes CP: (insert mode, Rewrite, Passive mode)
-Insert mode: F5 sẽ insert 1 cookie trong response của server trước khi gửi nó đến client.
                + Bất kể chọn giải pháp cookie nào, thì F5 cũng phải thiết lập tcp với client và kiểm tra request trước khi xử lý cookie hoặc chọn 1 pool member.
                +Với Insert mode, đầu tiên client kết nối tới VS ,các web browser của client ko chưa từng có cookie.
                + F5 nhận thấy nó hiện tại ko có cookie và chuyển nó tới pool member phù hợp. Các member tạo ra 1 http reply tới client maf ko có F5 cookie.
                + F5 sau đó insert 1 cookie với nhãn time và thông tin member cụ thể.
                + Trong thời gian này, khi lần thứ 2 client kết nối tới (còn timeout) thì F5 sẽ đọc cookie và sau đó thực hiện persist. Nếu hết timeout thì làm như ban đầu.
=> Ưu nhược điêm: ưu điểm là các application còn lại ko bị ảnh hưởng, nhược điểm là tăng khối lượng công việc cho F5.

-Rewrite mode: Các Pool member sẽ insert 1 cookie trống, và F5 sẽ viết lại cookie đó với các thông tin thích hợp như pool member.

Ưu điểm : chắc chắn chiều dài giới hạn cookie ko quá 4K. Trong insert mode có thể xảy ra lỗi này.
Nhược điểm: phải cấu hình content servers để thêm vào blank cookie.
-Passive mode: các pool member sẽ insert 1 cookie đúng format and F5 sẽ ko thay đổi nó.

Ưu điểm: giảm tải cho F5
Nhược điểm là: mỗi content server phải tạo ta 1 cấu hình cho F5 cookie.

==>> Vấn đề là ai tạo cookie: F5 alone (insert), server, F5 (rewrite) hay server alone (passive)
* có 2 vấn về hạn chế của CP là
1. CP chỉ cover đc http protocol
2. nếu users disable cookie, hoặc time,date trên pc bị off sẽ ko dc gửi từ browser client đến F5 để kiểm tra .
(*) Cấu hình cookie: phải cấu hình TCP profile và http profile trước, vì nó phụ thuộc.


Administrative state : dùng khi maintain
-Có 3 trạng thái members và nodes
            + Enable: cho phép tất cả các traffic: kết nối mới, persistence sessions và các kết nối hiện đang mở.
            + Disabled: chấp nhận những kết nối mới, nhưng chỉ trả lời clients những kết nối chưa hết timeout persistence
            +  Forced Offine: chỉ phục vụ những kết nối hiện đang mở(đang thao tác).
   =>khác nhau giữa Disabled và Forced Offine là có cookie persistence. Nếu Disable ko có Persistence Record thì giống Forced Offine.

2. SSL termination

Khi client gửi gói https đến server, mà F5 muốn đọc content của gói tin thì phải làm thế nào??
Phải dùng ssl profile, để session ssl chấm dứt tại F5 chứ không phải tại server vì những lý do sau.
- F5 chứa đựng phần cứng tăng tốc ssl. F5 có thể tăng tốc độ xử lý ssl.
- Cho phép server dành chu kỳ CPU của nó phục vụ nội dung gói tin hơn là việc giải mã và mã hóa ssl.
- Quản trị certificate dễ dàng hơn vì admin chỉ cần cài đặt ssl certificate trên 1 thiết bị(f5) hơn là trên mỗi pool member.
- Cho phép iRule xử lý và cookie persistence ( nếu ssl sd giữa client vs server thì F5 sẽ ko đọc được data và sẽ ko sử dụng dc cookie persistence).
- F5 có chứa card ssl accelerator, là gia tăng tốc độ trao đổi khóa và mã hóa vì nó thực hiện phần lớn trên phần cứng. Giúp tiết kiệm tiền cho việc mua ssl accelerator card cho mỗi server.

Nếu bất kỳ vị trí nào cũng cần phải mã hóa(việc này sẽ làm tăng thời gian xử lý) thì làm như sau:

Lời khuyên răng: khi sử dụng ssl certificate thì nên như sau: đối với mạng internal thì sử dụng ssl cer self-sign, còn đối với internet thì sử dụng(mua) cer từ 1 CA nào đó
Các bước khi sử dụng ssl Certificate (có thể self-sign hay mua)
(*) Các generate / import ssl (
- Import ssl mua từ 1 CA
--

- Generate ssl self-signed
Nơi lưu trữ Cer này trên F5 là
Bước 2:
Bước 3:
Tạo Server ssl profile


 

3. FPT profile

4 . Profile service

4.1. HTTP


- Fallback host: khi tất cả các thành viên trong pool hoặc pool number không sẵn sàng thì nó sẽ redirect tới 1 ip hoặc 1 url đã cấu hình (eg: client đang request tới vs:10.10.1.100 và cấu hình fallback vs: http://10.10.1.101 ==> khi các number trong pool của vs 100 ko sẵn sàng thì sẽ chuyển sang 101)

Monitor on F5 Big-IP

1. Address Check

Kiểm tra xem ip đó còn online hay ko, sử dụng icmp ==> kiểm tra nodes

2. Service Check

Kiểm tra  service đó còn chạy hay ko, bằng cách gửi  mở 1 tcp connection, nếu có response thì còn chạy và ngược lại ==> kiểm tra các thành viên của pool.
==>chỉ xác định service up hay down.

3. Content Check

Nó sẽ kiểm tra xem server đang respond có đúng nội dụng không.
Nếu mà server kết nối bị lỗi hay response ko đúng Receive string ==> member down hoặc ko có giá trị cho request của client.

4. Interactive Check

Các cái dịch vụ như FTP được yêu cầu kiểm tra thông tin giống như username, pass, directory, filename .
Big-ip sẽ mở 1 TCP connection và commands khởi tạo để gửi tới member.

Đây là lại check external. Có 1 chỉ đề riêng để nói về phần này vì nó rất khó và dài.

Priority Group Activation on F5 Big-Ip

Tham số này cho phép admin chỉ định các thành viên trong 1 pool thì server nào là preferred, server nào là backup. Chưc năng thường được sd khi có nhiều server không cần thiết dùng đến.
















Ví dụ trong trường hợp này thì chỉ cần 2 server là đủ đáo ứng traffic của các client. Nhưng để chắc chắn hơn thì ở đây ta dùng 3 server.
Ta cấu hình 3 server này với độ ưu tiên là 10 còn lại là 5. Nếu Priority Group Activation được set là 2 thì nó sẽ sử dụng 2 thành viên có độ ưu tiên cao nhất đầu tiên để nhận request (ở trong ví dụ này có 3 server có priority =10 nên nó sẽ sử dụng cả 3 server). Giả sử có 5 server cấu hình độ ưu tiên: srv1=10; srv2=5; srv3=5;srv4=5; srv5=1 thì khi cấu hình Priority Group Activation nó sẽ chạy request trên 4 con srv từ 1-4.  Nó sẽ thêm tất cả các server còn lại (vì cùng priority cùng = 5, nếu khác priority thì nó sẽ chọn 1 or 2 server có priority cao nhất trong số còn lại) trong pool khi 1 or 2 server(số server ít hơn 2 server online) đang chạy bị down.

xem lại Radio (member) và Radio (nodes)

Load Balancing on F5 Big-IP

1. Các phương pháp Load balancing

1.1. Round Robin

Khi sử dụng RR để load balancing thì sẽ dự theo server đang hoạt động theo tỉ lệ chia đều gói request tới tất cả các server.


1.2. Radio

 - Nếu chia load balancing theo radio tỉ lệ 3:2:1:1 thì khi client request các gói sẽ theo thứ tự từ 1->11 gửi đến các node trong pool.

1.3. Least connections

Là giải pháp đếm số tổng 1 service connection hiện tại để quyết định request tiếp theo của client sẽ gửi đến server nào



1.4. Fastest


1.5. Observed

Sẽ quan sát server nào có tổng trung bình connection ít hơn thì sẽ nhận nhiều request hơn, kết hơp với Radio
Ví dụ Server B,C đang ít hơn

1.6. Predictive

là giải pháp tương tự Observed nhưng gán giá trị Radio khác hơn
Ví dụ: B và D đang thấp hơn


How to install F5 on VMware

1. Cài đặt giả lập

- Link down: https://downloads.f5.com/esd/ecc.sv?sw=BIG-IP&pro=big-ip_v11.x&ver=11.3.0&container=Virtual-Edition-Trial
- Chọn bản download cho VMware.
- Đăng ký tài khoản trên trang: https://f5.com/products/trials/product-trials
=>General key:  Generate Registration Key

Let's start with the BIG-IP LTM Virtual Edition installation with VMware work-station.

F5 provides TRIAL Version license for 90 days.  Trial version available for F5 VE is 11.3.0 andBIGIP-11.3.0.39.0-scsi needs to be downloaded from the F5 Website.

Link : https://downloads.f5.com/esd/ecc.sv?sw=BIG-IP&pro=big-ip_v11.x&ver=11.3.0&container=Virtual-Edition-Trial

Below are the softwares needs to be downloaded :

1) BIG-IP LTM Virtual Edition (.ova format)
2) ovftool (to convert .ova to .ovf & from .ovf to .vmx and .vmdk)
3) VMware work-station

Step 1 : Download the f5 LTM VE file in .ova format

Step 2 : Convert the file .vmx format with below commands :

Go to command prompt.
- Go to cd "C:\Program Files\VMware\VMware OVF Tool"
- C:\Program Files\VMware\VMware OVF Tool>ovftool.exe "--- PATH to .ova file ----- \BIGIP-11.6.0.0.0.401.ALL-scsi.ova" "PATH\BIGIP-11.6.0.0.0.401.ALL-scsi.ovf"

and then convert .ovf file to .vmx and .vmdk

C:\Program Files\VMware\VMware OVF Tool>ovftool.exe "--- PATH to .ovf file ----- \BIGIP-11.6.0.0.0.401.ALL-scsi.ovf" "PATH\BIGIP-11.6.0.0.0.401.ALL-scsi.vmx"

Step 3 : Open the VMWare work station.

Go to File - Open and Open the .vmx file and the your F5 LTM VE is good to go.

Attaching VMConfig for F5 :




Step 4 : Power on the VM and you will prompted to BIG IP Login screen.



Step 5 : Log into Big-IP LTM with root user. Default password is default. Eth1.mgmt is pre-configured ip address 192.168.1.245/24.

Or else assign IP address to any of the Ethernet interface :
e.g. ifconfig eth0 10.1.1.245/24



Make sure that Network connections you have established in the VM are BRIDGED. So you will able to open the BIG - IP from your local machine and then it needs to be registered in order to use the Load-balancing features.

Step 6 : Login to https://192.168.1.245(Assigned IP Address) .
If bridged vm's network adapter to right local network card, browser should be able to open https://192.168.1.245. Default account for login is  admin/admin.

If you are facing any issues with the connectivity create a MS Loopback adapter on your system and make it gateway for F5 and simultaneously Go to VMware Workstation - Edit - Virtual Network Editor - Advanced - configure vmnet0 as Bridged to the MS Loopback adapter configured on your system. That will help in setting up connectivity.

Note : Loopback interface created on your system should be gateway of BIG-IP. So you will be able to reach BIG-IP from your local.



Now you should be able to access https://192.168.1.245.

Step 7 : And to configure BIG IP as per your IP Schema Type ‘config’ to access the ‘Configuration Utility’. Enter the mgmt ip address, netmask & default gateway details from the subnet associated with the mgmt interface and then access the http://IP address

Step 8 : Generate license keys from the F5 website if not done.  After login ,license needs to be activated first. Follow the below process :

There are 2 ways to activate license :
1) Automatic : Put the license key and activate it manually.If F5 has the internet access, it will      automatically activate the key.
 

2) Manual :  Create a dossier with the keys an access the license server. Upload the dossier and download the license to the BIG-IP.


Đăng ký key: https://www.f5.com/trial/big-ip-trial.php






Copy the Dossier from gui, go to the F5 licensing server ,  paste the dossier in the F5 licensing site, copy the license from the site and paste in the license section in the gui  click next.






 The bigip will activate the modules associated with the license (only LTM module in this trial edition). 







So BIG IP LTM is active now for iRules, iApps ,Virtual Server config,HA etc.... Explore.....

Đây là phần hướng dẫn trên trang : http://parthswadas.blogspot.com/

Adsense

Translate