Manual:IP/TFTP: Difference between revisions

From MikroTik Wiki
Jump to navigation Jump to search
(req-filename additional information)
Line 6: Line 6:


* '''ip-address''' ''(required)'' - range of IP addresses accepted as clients
* '''ip-address''' ''(required)'' - range of IP addresses accepted as clients
* '''req-filename''' - requested filename as ''regular expression (regex)''
* '''req-filename''' - requested filename as ''regular expression (regex)'' if field is left empty it defaults to ''.*''
* '''real-filename''' - if above two values are set and valid, the requested filename will be replaced with this. If this field is empty, the ''req-filename'' will be used. If multiple ''regex'' are specified in ''req-filename'', with this field you can set which ones should match, so this rule is validated. ''real-filename'' format for using multiple ''regex'' is '''filename\0\5\6'''
* '''real-filename''' - if above two values are set and valid, the requested filename will be replaced with this. If this field is empty, the ''req-filename'' will be used. If multiple ''regex'' are specified in ''req-filename'', with this field you can set which ones should match, so this rule is validated. ''real-filename'' format for using multiple ''regex'' is '''filename\0\5\6'''
* '''allow''' (''default: yes'') - to allow connection if above fields are set. if ''no'', connection will be interrupted
* '''allow''' (''default: yes'') - to allow connection if above fields are set. if ''no'', connection will be interrupted

Revision as of 05:48, 14 May 2009

Summary

TFTP is a very simple protocol used to transfer files. It is from this that its name comes, Trivial File Transfer Protocol or TFTP. Each nonterminal packet is acknowledged separately. RouterOS has a built-in TFTP server since v3.22

/ip tftp

  • ip-address (required) - range of IP addresses accepted as clients
  • req-filename - requested filename as regular expression (regex) if field is left empty it defaults to .*
  • real-filename - if above two values are set and valid, the requested filename will be replaced with this. If this field is empty, the req-filename will be used. If multiple regex are specified in req-filename, with this field you can set which ones should match, so this rule is validated. real-filename format for using multiple regex is filename\0\5\6
  • allow (default: yes) - to allow connection if above fields are set. if no, connection will be interrupted
  • read-only (default: no) - sets if file can be written to, if set to "no" write attempt will fail with error
  • hits - how many times this configuration entry has been executed (viewable only)

2009-04-03 1314.png

req-filename field allowed regexp

allowed regexps in this field are

  • brackets ()
  • caret "^" - used at the beginning of the line means that line starts with
  • asterisk "*" - matches any number of any symbols
  • dot "." - matches any symbol
  • square brackets [] - variation between as[df] will match asd and asf
  • dollar "$" - means at the end of the line

Examples

  • example 1 if file is requested return file from store called sata1:
/ip tftp add req-filename=file.txt real-filename=/sata1/file.txt allow=yes read-only=yes
  • example 2 if we want to give out one specific file no matter what user is requesting:
/ip tftp add req-filename=* real-filename=/sata1/file.txt allow=yes read-only=yes
  • example 3 if user requests aaa.bin or bbb.bin then give them ccc.bin:
/ip tftp add req-filename="(aaa.bin)|(bbb.bin)" real-filename="/sata1/ccc.bin\\0" allow=yes read-only=yes