The invention relates to the technical field of communication, and particularly provides a method and a device for realizing seven-layer NAT (
Network Address Translation) based on an openstack platform, which comprises the following steps of: firstly, creating a
virtual machine in a VPC
intranet, enabling FTP (
File Transfer Protocol) service by the
virtual machine, supporting a conntackhelper module by a
neutron through a plug-in, starting nfconntackhelper kernel forwarding in an exclusive
router of an existing virtual
private network, and starting an nfconntackhelper kernel forwarding in a
router exclusive to the existing virtual
private network; the method comprises the following steps: firstly, a
router is established, an FTP dual-channel port is established, an iptables rule for opening and closing an FTP dual-channel port is issued in the router through an interface, then, under the implementation of a helper module, internal and external conversion, namely conversion between floatingIp and an
intranet Ip, is carried out on an
IP address in seven
layers, and conversion between floatingIp and a
public network Ip in seven
layers of data is also carried out on a firewall. Compared with the prior art, the connection consistency of the
control channel and the
data channel can be ensured, the problem of connection interruption caused by obtaining the
private network address in the cloud is avoided, and mutual access of the external network and the internal network under a special protocol is completed.