How to Get Remote Ip from Order Magento 2?

The order contains a Remote IP address field in the sales_order table, the remote_ip field adds the customer system remote IP while they placing an order from the Front end.

Difference Between Order Placed from the Front end Vs Backend:
Remote IP field will be displayed only if the order is placed from the Frontend, for Order placed from the Backend(admin panel) not save the remote IP in the database table.

If Order contains the remote_ip field value, the Order is placed from the frontend otherwise its placed from the back end.

Using Order increment id, You can fetch Order Remote IP address by the below code snippet.

namespace Jesadiya\RemoteIp\Block;

use Exception;
use Psr\Log\LoggerInterface;
use Magento\Framework\View\Element\Template;
use Magento\Framework\Api\SearchCriteriaBuilder;
use Magento\Sales\Api\OrderRepositoryInterface;
use Magento\Framework\View\Element\Template\Context;

class OrderRemoteIp extends Template
     * @var SearchCriteriaBuilder
    protected $searchCriteriaBuilder;

     * @var LoggerInterface
    private $logger;

     * @var OrderRepositoryInterface
    private $orderRepository;

     * @var array
    private $data;

     * Demo constructor.
     * @param Context $context
     * @param SearchCriteriaBuilder $searchCriteriaBuilder
     * @param LoggerInterface $logger
     * @param OrderRepositoryInterface $orderRepository
     * @param array $data
    public function __construct(
        Context $context,
        SearchCriteriaBuilder $searchCriteriaBuilder,
        LoggerInterface $logger,
        OrderRepositoryInterface $orderRepository,
        array $data = []
    ) {
        $this->searchCriteriaBuilder = $searchCriteriaBuilder;
        $this->logger = $logger;
        $this->orderRepository = $orderRepository;

    public function getRemoteIp()
        $remoteIp = null;
        try {
            $incrementId = '1000000010';
            $searchCriteria = $this->searchCriteriaBuilder
                ->addFilter('increment_id', $incrementId)->create();
            $orderData = $this->orderRepository->getList($searchCriteria)->getItems();
            foreach ($orderData as $order) {
                if ($order->getRemoteIp()) {
                    $remoteIp = $order->getRemoteIp();
        } catch (Exception $exception) {

        return $remoteIp;

Get Remote IP using passing the Order Increment id to fetch order Remote IP.

Output:  If Order placed from the Front end
Output: will be null if an order is placed from the Back end.