Open the specified port for Ubuntu server

Source: Internet
Author: User

Refs

Http://askubuntu.com/questions/293356/how-to-open-a-particular-port-in-ubuntu


Run this on the commandline; It should solve Issue:sudo iptables-a input-m conntrack--ctstate new,related,established-j ACCEPT

To do a specific port:

sudo iptables-a input-p <tcp or udp> <--dport or--sport> <port>-j ACCEPT

The INPUT is the chain for incoming traffic. The-P is protocol (either TCP or UDP--dport or--sportspecify allowing for destination or source port.-j is ' jump ' and its where you ACCEPT, REJECT, ordrop the packet (s)

So, the open 5600 port receives the broadcast, the result:

sudo iptables-a input-p udp-d 0/0-S 0/0--dport 5600-j ACCEPT

Open 8000 ports receive TCP, as a result:

sudo iptables-a input-p tcp-d 0/0-S 0/0--dport 8000-j ACCEPT


Set the rules of the firewall to allow 5600 ports to enter

sudo ufw allow 5600

sudo ufw allow 8000


View Status:

sudo netstat-ntlup

NC Usage:

Refs

Http://manpages.ubuntu.com/manpages/hardy/man1/nc_openbsd.1.html


client/server MODEL

     NC.
     NC listening on a specific port for a connection.
     For example:

           $ nc-l 1234

     NC are now listening on port 1234 for a connection.  On a second console
     (or a second machine), connect to the machine and port being on:

           $ NC listened 1234



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.