specific source port translation

Hi,

I am trying to do SNAT while selecting a specific port for that but for some reason when the F5 receive the response it is sending a RST to the WS and not retranslating it to the original IP and port.

I configured the below:

when CLIENT_ACCEPTED {

set PublicIP 10.107.200.200

snat $PublicIP 12345

}

I can see that connection was created:

VIRTUAL any ↔ NODE 173.194.47.19:80 TYPE any 1/3

CLIENTSIDE 10.107.200.140:51251 ↔ 173.194.47.19:80

(pkts,bits) in = (2, 120) out = (0, 0)

SERVERSIDE 10.107.200.200:12345 ↔ 173.194.47.19:80

(pkts,bits) in = (0, 0) out = (2, 120)

PROTOCOL 6 UNIT 1 IDLE 2 (300) LASTHOP WDN_MIG_Internal 00:14:5e:a8:0a:04

This the tcpdump from the F5:

19:22:02.182260 IP 10.107.200.200.12345 > 173.194.47.19.80: S 1731136945:1731136945(0) win 5840

19:22:02.264415 IP 173.194.47.19.80 > 10.107.200.200.12345: S 718544173:718544173(0) ack 1731136946 win 1460

19:22:02.264439 IP 10.107.200.200.12345 > 173.194.47.19.80: R 1:1(0) ack 1 win 0

Do you have any idea why the F5 behave in that way?

Thanks a lot.

was syn-ack coming to correct vlan?

what version are you running? if it is 10.2.3+, you may try to log tcp rst packet.

sol13223:Configuring the BIG-IP system to log TCP RST packets

this is mine.

[root@ve10:Active] config  b virtual bar list
virtual bar {
   pool gw
   destination any:any
   mask 0.0.0.0
   ip protocol 6
   rules myrule
}
[root@ve10:Active] config  b pool gw list
pool gw {
   members 172.28.19.254:any {}
}
[root@ve10:Active] config  b rule myrule list
rule myrule {
   when CLIENT_ACCEPTED {
        snat 172.28.19.252 1234
}
}
[root@ve10:Active] config  b snat translation list
snat translation 172.28.19.252 {}

 tcpdump

[root@ve10:Active] config  tcpdump -nni 0.0 -s0 port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on 0.0, link-type EN10MB (Ethernet), capture size 65535 bytes
09:20:11.103550 IP 200.200.200.101.60204 > 172.28.19.251.80: S 4212438457:4212438457(0) win 5840  in slot1/tmm0 lis=
09:20:11.103603 IP 172.28.19.251.80 > 200.200.200.101.60204: S 2784638521:2784638521(0) ack 4212438458 win 4380  out slot1/tmm0 lis=bar
09:20:11.104573 IP 200.200.200.101.60204 > 172.28.19.251.80: . ack 1 win 46  in slot1/tmm0 lis=bar
09:20:11.104634 IP 172.28.19.252.1234 > 172.28.19.251.80: S 3603285261:3603285261(0) win 4380  out slot1/tmm0 lis=bar
09:20:11.105731 IP 200.200.200.101.60204 > 172.28.19.251.80: P 1:3(2) ack 1 win 46  in slot1/tmm0 lis=bar
09:20:11.105742 IP 172.28.19.251.80 > 172.28.19.252.1234: S 863226244:863226244(0) ack 3603285262 win 5792  in slot1/tmm0 lis=bar
09:20:11.105750 IP 172.28.19.252.1234 > 172.28.19.251.80: . ack 1 win 4380  out slot1/tmm0 lis=bar
09:20:11.105762 IP 172.28.19.252.1234 > 172.28.19.251.80: P 1:3(2) ack 1 win 4380  out slot1/tmm0 lis=bar
09:20:11.106790 IP 172.28.19.251.80 > 172.28.19.252.1234: . ack 3 win 46  in slot1/tmm0 lis=bar
09:20:11.205525 IP 172.28.19.251.80 > 200.200.200.101.60204: . ack 3 win 4382  out slot1/tmm0 lis=bar

 connection table

[root@ve10:Active] config  b conn client 200.200.200.101 show all
VIRTUAL any <-> NODE 172.28.19.251:80   TYPE any   1/0
    CLIENTSIDE 200.200.200.101:60204 <-> 172.28.19.251:80
        (pkts,bits) in = (3, 166)   out = (2, 116)
    SERVERSIDE 172.28.19.252:1234 <-> 172.28.19.251:80
        (pkts,bits) in = (2, 112)   out = (3, 170)
    PROTOCOL 6   UNIT 1   IDLE 4 (300)   LASTHOP internal 00:50:56:b3:01:0b

Hi nitass,

Thanks for the response.

I am running 10.2.4 HF5, What version you are running?

I tried what you suggest and I get the following log:

Feb 14 11:46:29 local/tmm2 err tmm2[5586]: 01230140:3: RST sent from 10.107.200.200:12345 to 173.194.47.80:80, [0x11d265d:1751] No local listener

I am trying to figure out why the F5 claims that there is no local listener if there is connection on that:

[root@LBA-F5-1A:Active] config b conn client 10.107.200.140 show all -n

VIRTUAL any ↔ NODE 10.115.243.30:53 TYPE any 1/2

CLIENTSIDE 10.107.200.140:41495 ↔ 10.115.243.30:53

(pkts,bits) in = (102, 7236) out = (0, 0)

SERVERSIDE 10.107.200.200:12345 ↔ 10.115.243.30:53

(pkts,bits) in = (0, 0) out = (102, 7236)

PROTOCOL 17 UNIT 1 IDLE 54 (300) LASTHOP WDN_MIG_Internal 00:14:5e:a8:0a:04

VIRTUAL any ↔ NODE 10.115.243.243:53 TYPE any 1/2

CLIENTSIDE 10.107.200.140:41495 ↔ 10.115.243.243:53

(pkts,bits) in = (105, 7467) out = (0, 0)

SERVERSIDE 10.107.200.200:12345 ↔ 10.115.243.243:53

(pkts,bits) in = (0, 0) out = (105, 7467)

PROTOCOL 17 UNIT 1 IDLE 3 (300) LASTHOP WDN_MIG_Internal 00:14:5e:a8:0a:04

VIRTUAL any ↔ NODE 10.115.243.243:53 TYPE any 1/1

CLIENTSIDE 10.107.200.140:54872 ↔ 10.115.243.243:53

(pkts,bits) in = (1, 55) out = (0, 0)

SERVERSIDE 10.107.200.200:12345 ↔ 10.115.243.243:53

(pkts,bits) in = (0, 0) out = (1, 55)

PROTOCOL 17 UNIT 1 IDLE 67 (300) LASTHOP WDN_MIG_Internal 00:14:5e:a8:0a:04

VIRTUAL any ↔ NODE 173.194.47.80:80 TYPE any 1/0

CLIENTSIDE 10.107.200.140:56476 ↔ 173.194.47.80:80

(pkts,bits) in = (3, 180) out = (0, 0)

SERVERSIDE 10.107.200.200:12345 ↔ 173.194.47.80:80

(pkts,bits) in = (0, 0) out = (3, 180)

PROTOCOL 6 UNIT 1 IDLE 104 (300) LASTHOP WDN_MIG_Internal 00:14:5e:a8:0a:04

This is the virtual server:

[root@LBA-F5-1A:Active] config b virtual Allow_Routes list

virtual Allow_Routes {

srcport change

ip forward

lasthop pool Last_HOP

destination any:any

mask 0.0.0.0

rules bbb

vlans WDN_MIG_Internal enable

}

and this is the rule:

rule bbb {

when CLIENT_ACCEPTED {

snat 10.107.200.200 12345

}

}

By the way in the first time that I tried to open connection it was successfully opened but after that all the attempts failed, including to another destination IP and also after cleaning all the connections on the F5.

I can’t see any logical reason why it is not working for me as expected :\

I am running 10.2.4 HF5, What version you are running?i am running 10.2.4 hf4.

[root@ve10:Active] config  b version|grep -iA 1 version
BIG-IP Version 10.2.4 655.0
Hotfix HF4 Edition

have you checked syn-ack’s incoming vlan? was it correct?

e.g.

tcpdump -e -nni 0.0 -s0 host 173.194.47.80 and port 80

The tcpdump that I am doing is for specific VLAN so for sure that the traffic returns to the same VLAN that it left.

Tell me the IP 172.28.19.252 is self IP in your F5?

Tell me the IP 172.28.19.252 is self IP in your F5?no, it is snat translation address. selfip is 172.28.19.253.

[root@ve10:Active] config  b self 172.28.19.253 list
self 172.28.19.253 {
   netmask 255.255.255.0
   vlan external
   allow default
}

and if you are trying to open few connection in parallel to different sites does it still work?

and if you are trying to open few connection in parallel to different sites does it still work?if it is different site, it works.

[root@ve10:Active] config  tcpdump -nni 0.0 port 80
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on 0.0, link-type EN10MB (Ethernet), capture size 108 bytes
21:38:11.510461 IP 200.200.200.101.51936 > 173.194.38.151.80: S 1650621809:1650621809(0) win 5840 
21:38:11.510525 IP 172.28.19.252.1234 > 173.194.38.151.80: S 1650621809:1650621809(0) win 5840 
21:38:11.520674 IP 173.194.38.151.80 > 172.28.19.252.1234: S 1436891886:1436891886(0) ack 1650621810 win 62920 
21:38:11.520686 IP 173.194.38.151.80 > 200.200.200.101.51936: S 1436891886:1436891886(0) ack 1650621810 win 62920 
21:38:11.521651 IP 200.200.200.101.51936 > 173.194.38.151.80: . ack 1 win 46
21:38:11.521662 IP 172.28.19.252.1234 > 173.194.38.151.80: . ack 1 win 46
21:38:23.717489 IP 200.200.200.111.33977 > 206.190.36.45.80: S 669688273:669688273(0) win 5840 
21:38:23.717558 IP 172.28.19.252.1234 > 206.190.36.45.80: S 669688273:669688273(0) win 5840 
21:38:23.932585 IP 206.190.36.45.80 > 172.28.19.252.1234: S 3507817701:3507817701(0) ack 669688274 win 5792 
21:38:23.932599 IP 206.190.36.45.80 > 200.200.200.111.33977: S 3507817701:3507817701(0) ack 669688274 win 5792 
21:38:23.933713 IP 200.200.200.111.33977 > 206.190.36.45.80: . ack 1 win 46 
21:38:23.933721 IP 172.28.19.252.1234 > 206.190.36.45.80: . ack 1 win 46

So why the hell in my F5 it is not working ?! :frowning:

I tried in 2 different boxes and still experiencing the same thing.. what am I missing??

would you mind opening a support case and let us know the case number?

i think it might be helpful if you can provide support engineer the following data.

1. qkview

2. tcpdump

tcpdump -nni 0.0:nnn -s0 -w /var/tmp/output.pcap host x.x.x.x

x.x.x.x is destination ip

just my 2 cents.

I opened a case and the number is C1290719, hopefully they will help me.

Thanks a lot for all the help so far :slight_smile:

one more thing, would you mind disabling cmp and trying again?

sol7751: Overview of Clustered Multi-Processing (9.x - 10.x)

I tried to disable it and still same behavior :\ it worked for the first connection and then stopped working.

another thing that I notice it is if I wait a long period of time and then trying again to open the connection it opens successfully only for the first one.. something is weird here..

in 10.2.3 I use an similar irule

thats it:

rule SNAT_OUT {

when CLIENT_ACCEPTED {

snat x.x.x.x

pool x

}

another thing that I notice it is if I wait a long period of time and then trying again to open the connection it opens successfully only for the first one.. something is weird here..

on 2nd attempt, did you connect to the same or different server? if it is the same one, did you see syn packet going out from port 12345?

by the way, tcpdump file would be indeed useful. i think it would be great if you can capture both traffic sides (client-side and server-side). i always capture on interface 0.0 with noisy option (:nnn).

tcpdump -nni 0.0:nnn -s0 -w /var/tmp/output.pcap host x.x.x.x

x.x.x.x is destination ip

Hi nitass, thanks again for the willing to help :slight_smile:

I connect to the same server, but I can see that the F5 is sending a SYN packet what means that it doesn’t using the port already.

do you know how I can upload a file here? I will be happy to show you the capture file.

thanks again for the willing to help :slight_smile: you are welcome. :slight_smile:

do you know how I can upload a file here? I will be happy to show you the capture file.sorry i do not know too. (=*=) anyway, i do not see capture file in C1290719. would you mind uploading to dropbox?

host: dropbox.f5.com

user: C1290719

password: customer contact email (f5…)

bigip sent reset (pkt 6) because syn-ack (pkt 5) was handled by different tmm. you could see syn (pkt 4) was sent out by tmm0 but syn-ack (pkt 5) was received by tmm1. how did you disable cmp?

No.     Time                       Delta Time  Source                Src port Destination           Protocol Dst port Window     BiF        Vlan id Length Info
      1 2013-02-15 18:34:21.759542 0.000000    10.159.121.107        1576     10.106.12.174         TCP      80       64512                 85      88     IN  s0/tmm0 : 1576 > 80 [SYN] Seq=389855322 Win=64512 Len=0 MSS=1237 SACK_PERM=1
      2 2013-02-15 18:34:21.759574 0.000032    10.106.12.174         80       10.159.121.107        TCP      1576     3711                  85      88     OUT s0/tmm0 : 80 > 1576 [SYN, ACK] Seq=1141266970 Ack=389855323 Win=3711 Len=0 MSS=1460 SACK_PERM=1
      3 2013-02-15 18:34:21.903207 0.143633    10.159.121.107        1576     10.106.12.174         TCP      80       64512                 85      86     IN  s0/tmm0 : 1576 > 80 [ACK] Seq=389855323 Ack=1141266971 Win=64512 Len=0
      4 2013-02-15 18:34:21.903264 0.000057    10.106.12.178         12345    10.106.12.40          TCP      8080     4380                  85      92     OUT s0/tmm0 : 12345 > 8080 [SYN] Seq=2863642582 Win=4380 Len=0 MSS=1460 WS=1 SACK_PERM=1
      5 2013-02-15 18:34:21.903472 0.000208    10.106.12.40          8080     10.106.12.178         TCP      12345    65535                 85      92     IN  s0/tmm1 : 8080 > 12345 [SYN, ACK] Seq=1064416826 Ack=2863642583 Win=65535 Len=0 MSS=1460 WS=1 SACK_PERM=1
      6 2013-02-15 18:34:21.903494 0.000022    10.106.12.178         12345    10.106.12.40          TCP      8080     0                     85      80     OUT s0/tmm1 : 12345 > 8080 [RST, ACK] Seq=2863642583 Ack=1064416827 Win=0 Len=0

I uploaded the capture file to the dropbox, the capture name is output.pcap

Please let me know if you see something suspicious in the capture.