Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open some ports on Ubuntu?

I know little about Linux.Today I create a VPN server on My ubuntu according to https://github.com/philplckthun/setup-simple-ipsec-l2tp-vpn But when I finish the installation. I use my iphone to connect the ipsect vpn,bur it shows the VPN Server has no response.

The github document shows

Ports 1701, 500 and 4500 must be opened for the VPN to work!

So I have tried to open these ports on my ubuntu server. I use "iptables" command to open these ports.but it failed.Maybe I don't known how to use this command correctly。So I want to know how can I open this ports on my ubuntu server? And if this ports have been opened successfully, can it be proved by the windows cmd window through telnet the port?

like image 391
elsonwx Avatar asked May 15 '15 05:05

elsonwx


People also ask

How do I open port 80 and 443 on Ubuntu Server?

Use below commands: sudo iptables -A INPUT -p tcp --dport 80 -j ACCEPT. sudo iptables -A INPUT -p tcp --dport 443 -j ACCEPT.


2 Answers

Ubuntu these days comes with ufw - Uncomplicated Firewall. ufw is an easy-to-use method of handling iptables rules.

Try using this command to allow a port

sudo ufw allow 1701 

To test connectivity, you could try shutting down the VPN software (freeing up the ports) and using netcat to listen, like this:

nc -l 1701 

Then use telnet from your Windows host and see what shows up on your Ubuntu terminal. This can be repeated for each port you'd like to test.

like image 176
shane Avatar answered Nov 10 '22 12:11

shane


If you want to open it for a range and for a protocol

ufw allow 11200:11299/tcp ufw allow 11200:11299/udp 
like image 39
Sanjeev Rohila Avatar answered Nov 10 '22 11:11

Sanjeev Rohila