summaryrefslogtreecommitdiffstats
path: root/src/scripts/vnet/ipsec
blob: 55cd914c4f75cc3ef47246e9345cd00253c40230 (plain)
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
create packet-generator interface pg0
create packet-generator interface pg1

pipe create

ip table add 1
set int ip table pg1 1
set int ip table pipe0.1 1

set int ip address pg0 192.168.0.1/24
set int ip address pg1 192.168.1.1/24

set int ip address pipe0.0 10.0.0.1/24
set int ip address pipe0.1 10.0.0.2/24

set int state pg0 up
set int state pg1 up
set int state pipe0 up

create ipsec tunnel local-ip 10.0.0.1 remote-ip 10.0.0.2 local-spi 100 remote-spi 101 local-crypto-key 6541686776336961656264656f6f6579 remote-crypto-key 6541686776336961656264656f6f6579 crypto-alg aes-cbc-128

set int state ipsec0 up
set int unnum ipsec0 use pg0

create ipsec tunnel local-ip 10.0.0.2 remote-ip 10.0.0.1 local-spi 101 remote-spi 100 tx-table 1 local-crypto-key 6541686776336961656264656f6f6579 remote-crypto-key 6541686776336961656264656f6f6579 crypto-alg aes-cbc-128

set int state ipsec1 up
set int ip table ipsec1 1
set int unnum ipsec1 use pg1

ip route add 192.168.1.0/24 via ipsec0
set ip neighbor pg1 192.168.1.2 00:11:22:33:44:55
ip route add table 1 192.168.0.0/24 via ipsec1
set ip neighbor pg0 192.168.0.2 00:11:22:33:44:66

trace add pg-input 100

packet-generator new {
  name ipsec1
  limit 1
  rate 1e4
  node ip4-input
  interface pg0
  size 100-100
  data {
   UDP: 192.168.0.2 -> 192.168.1.2
   UDP: 4321 -> 1234
    length 72
    incrementing 100
  }
}
packet-generator new {
  name ipsec2
  limit 1
  rate 1e4
  node ip4-input
  interface pg1
  size 100-100
  data {
   UDP: 192.168.1.2 -> 192.168.0.2
   UDP: 4321 -> 1234
    length 72
    incrementing 100
  }
}