31-Aug-2021
22:43
- last edited on
05-Jun-2023
23:02
by
JimmyPackets
Hi
when CLIENT_ACCEPTED {
set accepted_snat "172.16.0.174"
if { [ class exists smtp_relay_allowed ] }
{
if { [class match [IP::client_addr] equals smtp_relay_allowed] }
{
snat $accepted_snat
} else {
snat automap
log local0. "IP not allowed to relay: [IP::client_addr]"
}
} else {
snat automap
#log local0. "IP not allowed to relay: [IP::client_addr]"
}
}
01-Sep-2021
11:44
- last edited on
04-Jun-2023
19:19
by
JimmyPackets
Hi Muhammad Tanvir,
I think your irule is almost correct. Did it not work as you expected? I assume that as you already have a data group list named as "smtp_relay_allowed", initial checking of existence of this data group is not necessary. For simplicity;
when CLIENT_ACCEPTED {
set accepted_snat "172.16.0.174"
if { [class match [IP::client_addr] equals smtp_relay_allowed] } {
snat $accepted_snat
log local0. "IP allowed to relay: [IP::client_addr]"
} else {
snat automap
log local0. "IP not allowed to relay: [IP::client_addr]"
}
}
01-Sep-2021 20:27
Thanks Oguzy for your kind reply.
I rule works fine.
I want to update the data group list which has 172 IPs. List is 4 years old and a lot of systems are gone now. Before I update the list I want to enable logs and find out which systems are still actively using the virtual server
Could you please help me out to find out which logs I need to configure to capture IPs. There are many types Kind regarfds
Tanvir
01-Sep-2021
22:44
- last edited on
04-Jun-2023
19:19
by
JimmyPackets
Hi Tanvir,
As we specify "log local 0.", you should check "Local Traffic" Log on GUI or /var/log/ltm file on CLI. You can use both GUI and CLI. If you use CLI, you can check rotated (old ltm) logs via regex.
If you login via ssh to your BIG-IP device, you can try the following command:
grep "IP allowed to relay" /var/log/ltm*
Then you can inspect the IP address requesting to your virtual server.
01-Sep-2021 22:46
Hi again,
A quick reference for iRule logging and debugging commands:
02-Sep-2021 17:30
Thank you Oguzy for kind help.
Have a good day sir.