问题
I have set up an Amazon ec2 server but I want to open port 2195 and 443.
I already added ports from security group in Amazon console. When I listen port using
netstat -anltp | grep LISTEN
I got only two ports 23 and 80.
I also checked if ubuntu firewall is blocked or not.
Please help me.
回答1:
After you add the ports in EC2 Security Group, they are ready to be used by any process. Restarting your EC2 instance is also not needed.
netstat -anltp | grep LISTEN
will start showing the new ports as soon as some process is started which LISTEN on them
回答2:
Just restart the e2 instance and check it and make sure you have the saved the security group settings after adding the new ports.
回答3:
iptables -A INPUT -p tcp -d 0/0 -s 0/0 --dport PORT_NO_U_WANTED_TO_OPEN -j ACCEPT
try this .
回答4:
you can disable iptables on ec2 because because there is security group on console to limit open port, but here my solution if you still want to using it:
manual edit file /etc/sysconfig/iptables with the following step
flush iptables caches
iptables -F
edit the file
nano /etc/sysconfig/iptables
add you port and make sure the line like
-A INPUT -m state --state NEW -m tcp -p tcp --dport 443 -j ACCEPT
and not
-A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
save and restart iptables
service iptables save
service iptables restart
来源:https://stackoverflow.com/questions/15679227/how-can-i-open-port-2195-and-443-on-my-amazon-ec2-server