Home > other >  The iptables exposed localhost port services
The iptables exposed localhost port services

Time:03-10

A server installed the nic eth0, with network IP (assumptions: 192.168.1.3) and net outside IP (through a router, assumptions: 2), in 127.0.0.1 opens the port 8359, use "curl localhost: 8359" normal return page,
Now want to localhost: 8359 (native) mapped to: 1. 2. 8059 (net), try the following command:
 
# after run the following command cannot be accessed from outside the network, can only be used in server localhost: 8359 or 192.168.1.3:8059 can
Iptables -t NAT - A OUTPUT - d 192.168.1.3 -p TCP -- dport 8059 - j DNAT - to - destination 127.0.0.1:8359
# try to modify the target for the REDIRECT is not from the outside network access (on the server can access to success: localhost: 8359 or 192.168.1.3:8059)
Iptables -t NAT - A OUTPUT - d 192.168.1.3 -p TCP -- dport 8059 - j REDIRECT - to - destination 127.0.0.1:8359

Now on the server directly access "curl 192.168.1.3:8059" can return to normal web pages, but: can not connect through the network ~ (command: curl. 2:8059)
Consult need those configuration? Thank you very much!

CodePudding user response:

Server in the cloud, ali for aliyun operating system - Linux (centos kernel version?

CodePudding user response:

To cloud of ECS security group released 8059 port,

CodePudding user response:

If the machine has a firewall, the native firewall will release 8059

CodePudding user response:

Ali cloud security group by default all open (& lt; Except the port number 1024), the open port 8080, etc., from the network can be normal visit, not present cannot access:
 
Allow all 100
Objective: 1/- 1

Source: 0.0.0.0/0

This feeling does not have configured mainly iptables, or eth0 with lo card exchange is not allowed here?
reference X - I - n reply: 3/f
if this machine has a firewall, the native firewall will release 8059
  • Related