LoginSignup
2
2

More than 5 years have passed since last update.

BIG-IP iRule クライアントのIPアドレスに応じて割り振りPoolを変える

Last updated at Posted at 2017-03-09

iRule

iRule の PD には 'log local0.' を使用してログを吐かせると良いです。
HTTP_REQUES(HTTPがトリガ) は CLIENT_ACCEPTED(TCPがトリガ) にしてもOKです。

サンプルiRule

# 10.10.10.10 からの通信は pool1 へ割り振り
# 20.20.20.20 からの通信は pool2 へ割り振り
# その他は Pool3 へ割り振り

when HTTP_REQUEST {
  if {[IP::addr [IP::client_addr] equals 10.10.10.10]}{
  log local0. "[IP::client_addr] is accessing pool1"
    pool pool1
  } elseif {[IP::addr [IP::client_addr] equals 20.20.20.20]}{
  log local0. "[IP::client_addr] is accessing pool2"
    pool pool2
  } else {
  log local0. "[IP::client_addr] is accessing pool3"
    pool pool3
  }
}

ログ

こんな風にログが出ます。(/var/log/ltm)

[root@BIG-IP:Active] config # tailf /var/log/ltm
Mar  9 13:45:10 BIG-IP info tmm1[16270]: Rule /Common/irule1 <HTTP_REQUEST>: 10.10.10.10 is accessing pool1
Mar  9 13:47:59 BIG-IP info tmm1[16270]: Rule /Common/irule1 <HTTP_REQUEST>: 20.20.20.20 is accessing poo2
Mar  9 13:58:55 BIG-IP1600-4 info tmm[16270]: Rule /Common/ntn_irule1 <CLIENT_ACCEPTED>: 10.1.30.133 is accessing pool_ntn

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2