Forum Discussion
Redirect on UNC path
I use a iRules to do alot of redirecting based on HTTP header properties like this:
if { [HTTP::uri] contains " text " }
{
[HTTP::redirect "http://www.website.com"]
}
and all works wonderfully. Now I want to try and do a similar thing with UNC addresses
i.e
I'm loadbalancing two identical file stores on windows servers using the Big-IP and if some one connects to \\servername\sharename where the servername is actually a ViP on the Big-Ip I would like the client to be redirected to \\servername\sharename2.
I'm not sure where to start, can any one point me in the right direction?
Cheers
Simon
- Andrew78
Nimbostratus
Also looking for an answer to this question (version 11.5)
- Scott_Hopkins
Nimbostratus
So, there is no equivalent to the HTTP_REQUEST event for SMB (I'm assuming SMBv2). The only way I could think to do this is to implement an iRule using TCP::collect and the CLIENT_DATA event. You'd basically have to deconstruct the message format, and figure out the routing. Keep in mind, SMB isn't a single request/response like HTTP. There are 3 or 4 messages exchanges for security credentials before you even get to a message containing the UNC path. Sounds like an interesting challenge, but to be honest sounds more like ARX territory to me, unless you start making a bunch of assumptions and overhead.
- JRahm
Admin
Hey guys, not directly the solution, but this should help get there. This was an iRules contest submission several years ago.
This iRule takes an SMB pipe and renames the pipe name at the TCP level. In this case it takes PATH_CACHE_REMOTE_NORM and replaces it with PATH_CACHE_REMOTE_EMER. It works by bitwise replacing data in SMB TCP traffic. You have to enter the data in HEX and DEC format, but other than that the iRule is pretty straight forward.
when CLIENT_ACCEPTED { TCP::collect } when CLIENT_DATA { Stores the beginning and end points of the match in a list. if {[regexp -indices "\x50\x00\x41\x00\x54\x00\x48\x00\x5f\x00\x43\x00\x41\x00\x43\x00\x48\x00\x45\x00\x5f\x00\x52\x00\x45\x00\x4d\x00\x4f\x00\x54\x00\x45\x00\x5f\x00\x4e\x00\x4f\x00\x52\x00\x4d\x00" [TCP::payload] firstmatch]} { Subtracteds end point from start point and adds one Which gives the length of the replacement set matchlen [expr {[lindex $firstmatch 1] - [lindex $firstmatch 0] + 1}] Replace the original value with the replacement value, which is specified in binary. The replacement and original values should be the same length. TCP::payload replace [lindex $firstmatch 0] $matchlen [binary format c* {80 0 65 0 84 0 72 0 95 0 67 0 65 0 67 0 72 0 69 0 95 0 82 0 69 0 77 0 79 0 84 0 69 0 95 0 69 0 77 0 69 0 82 0}] } TCP::release TCP::collect }
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com