[--may-exist
] lr-nat-add
router type external_ip logical_ip
[logical_port external_mac]
Adds the specified NAT to router. The type must be one of
snat
, dnat
, or dnat_and_snat
. The external_ip is an IPv4
address. The logical_ip is an IPv4 network (e.g
192.168.1.0/24) or an IPv4 address. The logical_port and
external_mac are only accepted when router is a
distributed router (rather than a gateway router) and type
is dnat_and_snat
. The logical_port is the name of an
existing logical switch port where the logical_ip resides.
The external_mac is an Ethernet address.
When type is dnat
, the externally visible IP address
external_ip is DNATted to the IP address logical_ip in the
logical space.
When type is snat
, IP packets with their source IP address
that either matches the IP address in logical_ip or is in
the network provided by logical_ip is SNATed into the IP
address in external_ip.
When type is dnat_and_snat
, the externally visible IP
address external_ip is DNATted to the IP address
logical_ip in the logical space. In addition, IP packets
with the source IP address that matches logical_ip is
SNATed into the IP address in external_ip.
When the logical_port and external_mac are specified, the
NAT rule will be programmed on the chassis where the
logical_port resides. This includes ARP replies for the
external_ip, which return the value of external_mac. All
packets transmitted with source IP address equal to
external_ip will be sent using the external_mac.
It is an error if a NAT already exists with the same
values of router, type, external_ip, and logical_ip,
unless --may-exist
is specified. When --may-exist
,
logical_port, and external_mac are all specified, the
existing values of logical_port and external_mac are
overwritten.
[--if-exists
] lr-nat-del
router [type [ip]]
Deletes NATs from router. If only router is supplied, all
the NATs from the logical router are deleted. If type is
also specified, then all the NATs that match the type will
be deleted from the logical router. If all the fields are
given, then a single NAT rule that matches all the fields
will be deleted. When type is snat
, the ip should be
logical_ip. When type is dnat
or dnat_and_snat
, the ip
shoud be external_ip.
It is an error if ip is specified and there is no matching
NAT entry, unless --if-exists
is specified.
lr-nat-list
router
Lists the NATs on router.