A method for acquiring an Internet Protocol, IP, address in a network, wherein the network comprises a client, a relay agent, and a Dynamic Host Configuration Protocol, DHCP, server, the client is connected to the DHCP server via the relay agent, multiple gateway IP addresses corresponding to a type of the client are configured in the relay agent, and the method being characterized by: receiving, by the relay agent, the DHCP Discover packet from the client, replicating the DHCP Discover packet to obtain multiple DHCP Discover packets, adding one gateway IP address in the multiple gateway IP addresses to each DHCP Discover packet, and sending the multiple DHCP Discover packets carrying different gateway IP addresses to the DHCP server, so that the DHCP server allocates an IP address to the client, and sends a DHCP Offer packet to the client after determining that one gateway IP address in the multiple gateway IP addresses belongs to a same network segment as the allocated IP address; or receiving, by the relay agent, multiple DHCP Discover packets of the client, sequentially adding the multiple gateway IP addresses to the multiple DHCP Discover packets, and sending the multiple DHCP Discover packets to the DHCP server, wherein each DHCP Discover packet carries one different gateway IP address, so that the DHCP server allocates an IP address to the client, and sends a DHCP Offer packet to the client after determining that one gateway IP address in the multiple gateway IP addresses belongs to a same network segment as the allocated IP address; and the method further comprises: receiving, by the relay agent, a DHCP Request packet from the client, and acquiring the IP address of the client from an Option 50 field or a ciaddr field of DHCP Request packet; and adding, by the relay agent to the DHCP Request packet, the gateway IP address that is in the multiple gateway IP addresses and belongs to the same network segment as the IP address of the client, and sending the DHCP Request packet with the gateway IP address to the DHCP server, so that the DHCP server allocates the IP address to the client. receiving, by the relay agent, the DHCP Discover packet from the client, replicating the DHCP Discover packet to obtain multiple DHCP Discover packets, adding one gateway IP address in the multiple gateway IP addresses to each DHCP Discover packet, and sending the multiple DHCP Discover packets carrying different gateway IP addresses to the DHCP server, so that the DHCP server allocates an IP address to the client, and sends a DHCP Offer packet to the client after determining that one gateway IP address in the multiple gateway IP addresses belongs to a same network segment as the allocated IP address; or receiving, by the relay agent, multiple DHCP Discover packets of the client, sequentially adding the multiple gateway IP addresses to the multiple DHCP Discover packets, and sending the multiple DHCP Discover packets to the DHCP server, wherein each DHCP Discover packet carries one different gateway IP address, so that the DHCP server allocates an IP address to the client, and sends a DHCP Offer packet to the client after determining that one gateway IP address in the multiple gateway IP addresses belongs to a same network segment as the allocated IP address; and the method further comprises: receiving, by the relay agent, a DHCP Request packet from the client, and acquiring the IP address of the client from an Option 50 field or a ciaddr field of DHCP Request packet; and adding, by the relay agent to the DHCP Request packet, the gateway IP address that is in the multiple gateway IP addresses and belongs to the same network segment as the IP address of the client, and sending the DHCP Request packet with the gateway IP address to the DHCP server, so that the DHCP server allocates the IP address to the client. receiving, by the relay agent, a DHCP Request packet from the client, and acquiring the IP address of the client from an Option 50 field or a ciaddr field of DHCP Request packet; and adding, by the relay agent to the DHCP Request packet, the gateway IP address that is in the multiple gateway IP addresses and belongs to the same network segment as the IP address of the client, and sending the DHCP Request packet with the gateway IP address to the DHCP server, so that the DHCP server allocates the IP address to the client.