0

I want to open 5627 port on 127.0.0.1 with the following command

before

$ netstat -tln
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:11211         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:9292            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:45426           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:5939          0.0.0.0:*               LISTEN
tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN
tcp        0      0 127.0.1.1:53            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:3260            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:35357           0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:6080            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8773            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8774            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8775            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:9191            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:8776            0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:5000            0.0.0.0:*               LISTEN
tcp        0      0 192.168.1.101:27017     0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:27017         0.0.0.0:*               LISTEN
tcp6       0      0 :::80                   :::*                    LISTEN
tcp6       0      0 :::4369                 :::*                    LISTEN
tcp6       0      0 :::22                   :::*                    LISTEN
tcp6       0      0 ::1:631                 :::*                    LISTEN
tcp6       0      0 :::3260                 :::*                    LISTEN
tcp6       0      0 :::5672                 :::*                    LISTEN

$ netstat -tln | grep 5672
tcp6       0      0 :::5672                 :::*                    LISTEN

Open port 5672 for 127.0.0.1

$ iptables -A INPUT -ptcp --dport 5672 -j ACCEPT

Show port 5672

$ netstat -tln | grep 5672
tcp6       0      0 :::5672                 :::*

127.0.0.1:5672 is not open. How can I open local address 127.0.0.1:5672 ? Thank you!

1

netstat does not display ports that are open by iptables . It displays ports being listened to by a running program. You need to reconfigure your program to listen to 127.0.0.1, and then netstat will display it as "LISTENING".

0

The netstat command is showing what ports have a process listening on them. The iptables command manipulates port filtering in the kernel. Changes you make with iptables will not show up in the netstat command.

However, since you have a process listening on tcp6 :::5672 then this will also listen on the IPv4 port automatically.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.