Test connectivity for the web service: Difference between revisions

From LemonWiki共筆
Jump to navigation Jump to search
Line 2: Line 2:




=== Connecting from the local machine to web service at the same server ===
== Connecting from the local machine to web service at the same server ==
WAN &#9675; -------&gt; &#9675; LAN -------&gt; <span style="color:red">&#9679; server</span>
WAN &#9675; -------&gt; &#9675; LAN -------&gt; <span style="color:red">&#9679; server</span>


Testing on localhost if you have the administrative permission to manage the server.
Testing on localhost if you have the administrative permission to manage the server.
* Check if your computer/server Is being assigned the IP Address.
 
 
=== Check if your computer/server Is being assigned the IP Address ===
** {{Linux}}: (1) Check the IP Address. {{kbd | key = ifconfig}}. (2) Re-assign the IP Address and restart the networking service. {{kbd | key = service network restart}} for CentOS<ref>[http://askubuntu.com/questions/230698/how-to-restart-the-networking-service How to restart the networking service? - Ask Ubuntu]</ref>
** {{Linux}}: (1) Check the IP Address. {{kbd | key = ifconfig}}. (2) Re-assign the IP Address and restart the networking service. {{kbd | key = service network restart}} for CentOS<ref>[http://askubuntu.com/questions/230698/how-to-restart-the-networking-service How to restart the networking service? - Ask Ubuntu]</ref>
** {{Win}}: Check the IP Address. {{kbd | key = ifconfig/all}}  
** {{Win}}: Check the IP Address. {{kbd | key = ifconfig/all}}  
** More on [[Network problem]]
** More on [[Network problem]]
* Is service alive? Is the port occupied by other process?
 
=== Is the service alive or the port was occupied by other process? ===
** {{Linux}}  
** {{Linux}}  
*** [http://linux.die.net/man/1/nmap nmap] "Network exploration tool and security / port scanner." e.g. {{kbd | key = <nowiki>nmap -p 80,443 ip</nowiki>}}
*** [http://linux.die.net/man/1/nmap nmap] "Network exploration tool and security / port scanner." e.g. {{kbd | key = <nowiki>nmap -p 80,443 ip</nowiki>}}
Line 25: Line 28:
// means the 80 port service is running
// means the 80 port service is running
</pre>
</pre>
* more on [[Find process running on port]]
=== Is the port opened for external users? ===
Check the OS firewall or protected by antivirus software


* Is the port opened for external users? OS firewall or protected by antivirus software.
** {{Linux}}
** {{Linux}}
*** [http://linux.die.net/man/8/iptables iptables]: (1) {{kbd | key = iptables -L}} to list all rules<ref>[http://wiki.centos.org/HowTos/Network/IPTables HowTos/Network/IPTables - CentOS Wiki]</ref> (2) rule with smaller line-number will override the rule with larger line-number<ref>[https://fedoraproject.org/wiki/How_to_edit_iptables_rules?rd=User_talk:Rforlot How to edit iptables rules - FedoraProject]</ref>
*** [http://linux.die.net/man/8/iptables iptables]: (1) {{kbd | key = iptables -L}} to list all rules<ref>[http://wiki.centos.org/HowTos/Network/IPTables HowTos/Network/IPTables - CentOS Wiki]</ref> (2) rule with smaller line-number will override the rule with larger line-number<ref>[https://fedoraproject.org/wiki/How_to_edit_iptables_rules?rd=User_talk:Rforlot How to edit iptables rules - FedoraProject]</ref>

Revision as of 15:40, 23 March 2022

find the problem occurred: (1) local service at the server (localhost) (2) from LAN to server (3) from WAN to server


Connecting from the local machine to web service at the same server

WAN ○ -------> ○ LAN -------> ● server

Testing on localhost if you have the administrative permission to manage the server.


Check if your computer/server Is being assigned the IP Address

    • Linux Os linux.png : (1) Check the IP Address. ifconfig. (2) Re-assign the IP Address and restart the networking service. service network restart for CentOS[1]
    • Win Os windows.png : Check the IP Address. ifconfig/all
    • More on Network problem

Is the service alive or the port was occupied by other process?

    • Linux Os linux.png
      • nmap "Network exploration tool and security / port scanner." e.g. nmap -p 80,443 ip
      • ss "utility to investigate sockets" e.g. ss -tnlp | grep 80 or using OR operator[2] ss -tnlp | grep '80\|443'
      • ps List the current processes. Input ps -aux | grep "PORT_NUMBER" e.g. ps -aux | grep 443
      • netstat Command netstat -tulpn | grep LISTEN e.g.
    • Win Os windows.png Using the software CurrPorts to check the process and port. e.g. Apache will not running if the 80 port was occupied by skype[3].
$ netstat -tulpn | grep LISTEN

tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      - 

// means the 80 port service is running

Is the port opened for external users?

Check the OS firewall or protected by antivirus software

    • Linux Os linux.png
      • iptables: (1) iptables -L to list all rules[4] (2) rule with smaller line-number will override the rule with larger line-number[5]
      • FirewallD rules: (1) sudo firewall-cmd --get-default-zone return 'public' (2) sudo firewall-cmd --list-all --zone=public[6] (3) Allow port with FirewallD
      • SELinux Policy Management: (1) After installed policycoreutils-python[7], input semanage port -l to list open ports. (2) Allow port with semanage.
    • Win Os windows.png Windows Firewall with Advanced Security -> configure firewall rules
    • protected by antivirus software?
  • connect to localhost ex: telnet 127.0.0.1 23 where 23 is the port number where the service running
    • Install Telnet Client on Win Os windows.png
    • if the local service is web server, you can also try lynx http://127.0.0.1 for Linux Os linux.png
  • double check the server/service logs

Connecting from LAN to the server

WAN ○ -------> ● LAN -------> ● server

Testing on LAN (local network, subnet scope): The different servers between LAN or with the same ip class (ex: 1.2.3.*) may not have the firewall limit.

  • Is the service alive?
  • Connect to the internal IP eg: telnet 172.18.0.1 23 (1) IP start with 172.18... is Private IP Network Numbers (2) where 23 is the port number where the service running
  • If the local service is web server, you can also try to connect the internal IP e.g. lynx http://172.18.0.1 for Linux Os linux.png
  • Double check the server/service logs

Connecting from WAN to the server

WAN ● -------> ● LAN -------> ● server

We met the trouble on WAN (wide area network). If we do no have the administrative permission, the tests we can do as follows:

other issue: