The client ip can be retrieved using
CopygetClientIp()
getClientIp()
method in
CopyMagento\Framework\HTTP\PhpEnvironment\Request
Magento\Framework\HTTP\PhpEnvironment\Request
class. This is very useful , when do the ip restriction in maintenance page development.