获取服务端ip InetAddress address = InetAddress.getLocalHost(); return address.getHostAddress(); 客户端ip HttpServletRequest request request.getRemoteAddr();