当前位置:   article > 正文

IPsec配置工具IP xfrm

ip xfrm

IP命令支持IPSec配置,子命令为ip xfrm。命令内容如下:
IP-XFRM(8) Linux IP-XFRM(8)

NAME

   ip-xfrm - transform configuration
  • 1

SYNOPSIS

   ip [ OPTIONS ] xfrm  { COMMAND | help }
   ip xfrm XFRM-OBJECT { COMMAND | help }
   XFRM-OBJECT := state | policy | monitor
   
   ip xfrm state { add | update } ID [ ALGO-LIST ] [ mode MODE ] [ mark MARK [ mask MASK ] ] [ reqid REQID ]  [seq SEQ ] [ replay-window SIZE ] [ replay-seq SEQ ] [ replay-oseq SEQ ] [ flag FLAG-LIST ] [ sel SELECTOR ] [ LIMIT-LIST ] [ encap ENCAP ] [ coa ADDR[/PLEN] ] [ ctx CTX ] [ extra-flag EXTRA-FLAG-LIST ]
           
   ip xfrm state allocspi ID [ mode MODE ] [ mark MARK [ mask MASK ] ] [ reqid REQID ] [ seq SEQ ] [ min SPI max SPI ]
   ip xfrm state { delete | get } ID [ mark MARK [ mask MASK ] ]
   ip xfrm state { deleteall | list } [ ID ] [ mode MODE ] [ reqid REQID ] [ flag FLAG-LIST ]
   ip xfrm state flush [ proto XFRM-PROTO ]
   ip xfrm state count

   ID := [ src ADDR ] [ dst ADDR ] [ proto XFRM-PROTO ] [ spi SPI ]
   
   XFRM-PROTO := esp | ah | comp | route2 | hao
   
   ALGO-LIST := [ ALGO-LIST ] ALGO
   
   ALGO := { enc | auth } ALGO-NAME ALGO-KEYMAT |
           auth-trunc ALGO-NAME ALGO-KEYMAT ALGO-TRUNC-LEN |
           aead ALGO-NAME ALGO-KEYMAT ALGO-ICV-LEN |
           comp ALGO-NAME
           
   MODE := transport | tunnel | beet | ro | in_trigger
   
   FLAG-LIST := [ FLAG-LIST ] FLAG
   
   FLAG := noecn | decap-dscp | nopmtudisc | wildrecv | icmp | af-unspec | align4
   
   SELECTOR := [ src ADDR[/PLEN] ] [ dst ADDR[/PLEN] ] [ dev DEV ] [ UPSPEC ]
   
   UPSPEC := proto { PROTO |
           { tcp | udp | sctp | dccp } [ sport PORT ] [ dport PORT ] |
           { icmp | ipv6-icmp | mobility-header } [ type NUMBER ] [ code NUMBER ] |
           gre [ key { DOTTED-QUAD | NUMBER } ] }
           
   LIMIT-LIST := [ LIMIT-LIST ] limit LIMIT
   
   ip xfrm policy { delete | get } { SELECTOR | index INDEX } dir DIR [ ctx CTX ] [ mark MARK [ mask MASK ] ] [ ptype PTYPE ]
   ip xfrm policy { deleteall | list } [ SELECTOR ] [ dir DIR ] [ index INDEX ] [ ptype PTYPE ] [ action ACTION ] [ priority PRIORITY ] [ flag FLAG-LIST]
   ip xfrm policy flush [ ptype PTYPE ]
   ip xfrm policy count
   ip xfrm policy set [ hthresh4 LBITS RBITS ] [ hthresh6 LBITS RBITS ]

   SELECTOR := [ src ADDR[/PLEN] ] [ dst ADDR[/PLEN] ] [ dev DEV ] [ UPSPEC ]

   UPSPEC := proto { PROTO |
           { tcp | udp | sctp | dccp } [ sport PORT ] [ dport PORT ] |
           { icmp | ipv6-icmp | mobility-header } [ type NUMBER ] [ code NUMBER ] |
           gre [ key { DOTTED-QUAD | NUMBER } ] }

   DIR := in | out | fwd

   PTYPE := main | sub

   ACTION := allow | block

   FLAG-LIST := [ FLAG-LIST ] FLAG

   FLAG := localok | icmp

   LIMIT-LIST := [ LIMIT-LIST ] limit LIMIT

   LIMIT := { time-soft | time-hard | time-use-soft | time-use-hard } SECONDS | { byte-soft | byte-hard } SIZE | { packet-soft | packet-hard } COUNT

   TMPL-LIST := [ TMPL-LIST ] tmpl TMPL

   TMPL := ID [ mode MODE ] [ reqid REQID ] [ level LEVEL ]

   ID := [ src ADDR ] [ dst ADDR ] [ proto XFRM-PROTO ] [ spi SPI ]

   XFRM-PROTO := esp | ah | comp | route2 | hao

   MODE := transport | tunnel | beet | ro | in_trigger

   LEVEL := required | use

   ip xfrm monitor [ all-nsid ] [ all | LISTofXFRM-OBJECTS ]

   LISTofXFRM-OBJECTS := [ LISTofXFRM-OBJECTS ] XFRM-OBJECT

   XFRM-OBJECT := acquire | expire | SA | policy | aevent | report
   ip xfrm state allocspi    allocate an SPI value
   ip xfrm state delete      delete existing state in xfrm
   ip xfrm state get         get existing state in xfrm
   ip xfrm state deleteall   delete all existing state in xfrm
   ip xfrm state list        print out the list of existing state in xfrm
   ip xfrm state flush       flush all state in xfrm
   ip xfrm state count       count all existing state in xfrm

   ID     is  specified  by a source address, destination address, transform protocol XFRM-PROTO, and/or Security
          Parameter Index SPI.  (For IP Payload Compression, the Compression Parameter Index or CPI is  used  for
          SPI.)

   XFRM-PROTO
          specifies a transform protocol: IPsec Encapsulating Security Payload (esp), IPsec Authentication Header
          (ah), IP Payload Compression (comp), Mobile IPv6 Type 2 Routing Header (route2), or  Mobile  IPv6  Home
          Address Option (hao).

   ALGO-LIST
          contains one or more algorithms to use. Each algorithm ALGO is specified by:

          ·      the algorithm type: encryption (enc), authentication (auth or auth-trunc), authenticated encryp‐
                 tion with associated data (aead), or compression (comp)

          ·      the algorithm name ALGO-NAME (see below)

          ·      (for all except comp) the keying material ALGO-KEYMAT, which may include both a key and  a  salt
                 or nonce value; refer to the corresponding RFC

          ·      (for auth-trunc only) the truncation length ALGO-TRUNC-LEN in bits

          ·      (for aead only) the Integrity Check Value length ALGO-ICV-LEN in bits

          Encryption  algorithms  include  ecb(cipher_null),  cbc(des), cbc(des3_ede), cbc(cast5), cbc(blowfish),
          cbc(aes), cbc(serpent), cbc(camellia), cbc(twofish), and rfc3686(ctr(aes)).

          Authentication algorithms  include  digest_null,  hmac(md5),  hmac(sha1),  hmac(sha256),  hmac(sha384),
          hmac(sha512), hmac(rmd610), and xcbc(aes).

          Authenticated   encryption   with   associated   data   (AEAD)  algorithms  include  rfc4106(gcm(aes)),
          rfc4309(ccm(aes)), and rfc4543(gcm(aes)).

          Compression algorithms include deflate, lzs, and lzjh.

   MODE   specifies a mode of operation for the transform protocol. IPsec and IP Payload  Compression  modes  are
          transport,  tunnel,  and  (for  IPsec  ESP only) Bound End-to-End Tunnel (beet).  Mobile IPv6 modes are
          route optimization (ro) and inbound trigger (in_trigger).

   FLAG-LIST
          contains one or more of the following optional flags: noecn, decap-dscp,  nopmtudisc,  wildrecv,  icmp,

   LIMIT-LIST
          sets limits in seconds, bytes, or numbers of packets.

   ENCAP  encapsulates  packets  with  protocol espinudp or espinudp-nonike, using source port SPORT, destination port DPORT , and original address OADDR.

   ip xfrm policy add         add a new policy
   ip xfrm policy update      update an existing policy
   ip xfrm policy delete      delete an existing policy
   ip xfrm policy get         get an existing policy
   ip xfrm policy deleteall   delete all existing xfrm policies
   ip xfrm policy list        print out the list of xfrm policies
   ip xfrm policy flush       flush policies

   SELECTOR
          selects the traffic that will be controlled by the policy, based on the source address, the destination
          address, the network device, and/or UPSPEC.

   UPSPEC selects traffic by protocol. For the tcp, udp, sctp, or dccp protocols, the source and destination port
          can optionally be specified.  For the icmp, ipv6-icmp, or mobility-header protocols, the type and  code
          numbers  can  optionally  be specified.  For the gre protocol, the key can optionally be specified as a
          dotted-quad or number.  Other protocols can be selected by name or number PROTO.

   DIR    selects the policy direction as in, out, or fwd.

   CTX    sets the security context.

   PTYPE  can be main (default) or sub.

   ACTION can be allow (default) or block.

   PRIORITY
          is a number that defaults to zero.

   FLAG-LIST
          contains one or both of the following optional flags: local or icmp.

   LIMIT-LIST
          sets limits in seconds, bytes, or numbers of packets.
          (ah),  IP  Payload  Compression (comp), Mobile IPv6 Type 2 Routing Header (route2), or Mobile IPv6 Home Address Option (hao).

   MODE   specifies a mode of operation for the transform protocol. IPsec and IP Payload  Compression  modes  are
          transport,  tunnel,  and  (for  IPsec  ESP only) Bound End-to-End Tunnel (beet).  Mobile IPv6 modes are
          route optimization (ro) and inbound trigger (in_trigger).

   LEVEL  can be required (default) or use.

   ip xfrm policy count   count existing policies

   Use one or more -s options to display more details, including policy hash table information.

   ip xfrm policy set   configure the policy hash table

   Security policies whose address prefix lengths are greater than or equal  policy  hash  table  thresholds  are
   hashed. Others are stored in the policy_inexact chained list.

   LBITS  specifies  the  minimum  local address prefix length of policies that are stored in the Security Policy
          Database hash table.

   RBITS  specifies the minimum remote address prefix length of policies that are stored in the  Security  Policy
          Database hash table.

   ip xfrm monitor    state monitoring for xfrm objects

   The xfrm objects to monitor can be optionally specified.

   If  the  all-nsid  option is set, the program listens to all network namespaces that have a nsid assigned into
   the network namespace were the program is running.  A prefix is displayed to show the network namespace  where
   the message originates. Example:

     [nsid 1]Flushed state proto 0
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/我家自动化/article/detail/814560
推荐阅读
相关标签
  

闽ICP备14008679号