VPP中sNAT及dNAT


sNAT

  • 范式

nat44 add address nat44 add address [- ] [tenant-vrf ] [twice-nat] [del]

set interface nat44 in out [output-feature] [del]

1
2
3
4
5
6
7
#sNat设置G0为出口
nat44 add interface address G0
#设置源nat的接口
set interface nat44 in loop0 out G0

#查看
show nat44 interfaces

dNAT

  • 范式

nat44 add static mapping nat44 add static mapping tcp|udp|icmp local [] external

1
2
3
4
5
#设置dNat,将G0口的tcp 22端口号映射到本地192.168.1.1的22端口号
nat44 add static mapping tcp local 192.168.1.1 22 external G0 22

#查看
show nat44 static mapping