Danrancan
Posts: 39
Joined: Wed Jan 15, 2020 4:28 am
Location: Milwaukee, WI, USA
Contact: Website Twitter

Using Terminal to scan open ports from the WAN side.

Sat Feb 08, 2020 7:07 am

Hi, I am running a webserver from my home. It is connected to my router, and my router has it's ports forwarded to the webserver on port 80 and port 443. Every router is different, so using port scan services from an external scanner is essential for me to test if my ports are available on my server.

Usually, to open up ports on my server, i use

Code: Select all

sudo iperf3 -s -p 80
,

Code: Select all

sudo iperf3 -s -p 443
, and any other ports that I want to test from my routers forwarding settings etc. etc. Then, from my raspberry pi desktop web browser, i go to https://www.whatsmyip.org/port-scanner/server/ and use their service to scan my ports from the wide area network (WAN) side, which tells me weather or not my ports are properly forwarded from my router.

My problem is that I usually ssh into my server and run it headless. So when i want to test my forwarded ports, I have to change my settings in raspi-config to boot up in desktop mode.

That being said, MY QUESTION IS:
Is there an easy way to do a wide area network portscan similar to what https://www.whatsmyip.org/port-scanner/server/ does, from the terminal using ssh on my pi? It would be much more convenient than having to log into my pi directly as a desktop user. If so, please explain and clue me in!

Thank you so much for taking the time to help answer this question. All help is appreciated!
Nerd-Tech - Exploring Technology, Computers, and Techno…
https://github.com/danrancan
dan@nerd-tech.net
https://nerd-tech.net
https://keybase.io/danran/
My Keybase Invite https://keybase.io/inv/5a35010417/

User avatar
Skraaj
Posts: 29
Joined: Wed Nov 20, 2019 11:35 pm
Contact: Website

Re: Using Terminal to scan open ports from the WAN side.

Sat Feb 08, 2020 7:23 am

Use the following

Code: Select all

sudo netstat -lntp
Do not skip sudo, it gives less information without it.
codedoneright.eu – newbie friendly raspberry tutorials

tpyo kingg
Posts: 809
Joined: Mon Apr 09, 2018 5:26 pm
Location: N. Finland

Re: Using Terminal to scan open ports from the WAN side.

Sat Feb 08, 2020 9:08 am

Also, you can install lynx and go to a service like https://canyouseeme.org/ and check one port at a time.

If you have a machine outside your network you can do a more detailed scan using nmap.

Danrancan
Posts: 39
Joined: Wed Jan 15, 2020 4:28 am
Location: Milwaukee, WI, USA
Contact: Website Twitter

Re: Using Terminal to scan open ports from the WAN side.

Sun Feb 09, 2020 2:39 am

Skraaj wrote:
Sat Feb 08, 2020 7:23 am
Use the following

Code: Select all

sudo netstat -lntp
Do not skip sudo, it gives less information without it.
Thank you much good sir! I will try this when I get home!
Nerd-Tech - Exploring Technology, Computers, and Techno…
https://github.com/danrancan
dan@nerd-tech.net
https://nerd-tech.net
https://keybase.io/danran/
My Keybase Invite https://keybase.io/inv/5a35010417/

Danrancan
Posts: 39
Joined: Wed Jan 15, 2020 4:28 am
Location: Milwaukee, WI, USA
Contact: Website Twitter

Re: Using Terminal to scan open ports from the WAN side.

Sun Feb 09, 2020 2:39 am

tpyo kingg wrote:
Sat Feb 08, 2020 9:08 am
Also, you can install lynx and go to a service like https://canyouseeme.org/ and check one port at a time.

If you have a machine outside your network you can do a more detailed scan using nmap.
Thank you much good sir! I will try this when I get home!
Nerd-Tech - Exploring Technology, Computers, and Techno…
https://github.com/danrancan
dan@nerd-tech.net
https://nerd-tech.net
https://keybase.io/danran/
My Keybase Invite https://keybase.io/inv/5a35010417/

Return to “Networking and servers”