How to change default port EMM WSO - wso2-iot

How to change default port EMM WSO2, Change management port 9443
I have ESB e EMM installed in only one server but the two services used port 9443.
I need change EMM port number.

The default HTTP and HTTPS ports of a WSO2 product are 9763 and 9443 respectively. You can change the port by increasing the port offset, default offset is 0, you increase value to the offset this will result in a new port for the wso2 emm server.New port value will be the default value plus the offset value.
Ex:
For port offset 1 HTTPS port will be 9443.
For port offset 1 HTTP port will be 9763.
For port offset 2 HTTPS port will be 9444.
There are two ways to set an offset to a port:
Pass the port offset to the server during startup. The following
command starts the server with the default port incremented by
3:./wso2server.sh -DportOffset=3
Set the Ports section of
/repository/conf/carbon.xml as
follows:3

Related

Load Balance server HAProxy or alternative

I need load balance server. LB should listen multiple ports and forward to backend servers with the same ports.
Logic for backed should be always send tcp requests to A server with same ports which is defined in LB server, and if A server is down forward to Server B.
Example:
LB port 10202 to Backend port 10202
LB port 10203 to Backend port 10203
Is it possible?
Unless I miss-understand then that sounds fairly simple. Just use a port range. Any port in the range is accepted and DONT specify the port on the backend i.e. keep the one you come in on:
listen L7_HTTP
    bind 10.0.0.20:10202-10203
    server RS001 127.0.127.1 check
    server RS002 127.0.127.2 check

How web server handles connections which are same ports & IP Addresses?

I open IE explorer & Chrome in my computer and type localhost:80 and I get the index page.
Here I think my machine's IP is same to both connections (IE explorer & Chrome) and ports are too (80).
Note: Source port will be different (as destination is same: localhost IP), this is my second question.
So how webserver (lets say apache) handles this port 80 connections without failing? Does it port forwarding? In OS level even I tried with addr re-use, port re-use parameters and it is all same we cannot make multiple connection with same IPs & ports.
Now, probably you have came up with a solution: although source ports and IPs are same, destination port is different in package: <protocol>, <src addr>, <src port>, <dest addr>, <dest port>.
A. I got 49483~50004 ports as you can see on image. How client knows which destination port (49483~50004) is bound by webserver? If it is random between 0 and 65355 the webserver always binds all ports, it is very resource consuming. How webservers avoid from this?
Look at this image: command prompt-> netstat
If this question is related with low level sources it is OK, I understand Embedded TCP/IP/UDP, Phy MAC communication and package structures.
You have this all back to front.
All the port numbers at the server are the same: 80. So the client only has to know port 80.
All the port numbers at the client are different: 49483-50004 etc. So there is no ambiguity in the connection, because the 4-tuple you mentioned is unique.
All http request by default call to servers in the port 80, because servers listen by default in that port. So you only give an IP or hostname and the web browser add the default port (80). You can give a custom port if you web server is listenning in another port (usually Tomcat listen by default in 8080) for example you call it in: http://www.youamazingweb.com:8080.
A good example is see the IP as the home and the port is the door where clients enter to consume some resource hosted in server.

How is it that Apache and Firefox can use port 80 (or sometimes port 8080) simultaneously?

The Apache webserver uses port 80 to listen for incoming requests and replies over port 80. Firefox uses port 80 to send requests to webservers and then listens on port 80 for the response from the webserver. I have run Apache and Firefox simultaneously before and am just wondering how two different programs can share the same port.
Each side of a TCP network connection is defined by a touple of (ipaddress, port #). When a packet leaves your system all it knows is that it needs to find ip address 192.168.1.1 and go the whoever has a socket bound to port 80.
A server socket is going to be defined by the address on which Apache is listening and port 80. The client socket open by Firefox will have the same ip address but a different randomly assign port number which you normally do not see.
You can see it using netstat or tcpview (Windows)
For example when I run netstat right now I see:
tcp4 0 0 x.x.x.x.62993 stackoverflow.co.https ESTABLISHED
where x.x.x.x is my laptops ip address and 62993 is the random port number assigned to my web browser.
Firefox isn't listening to port 80. It's making a request to a server port and handling the response.

Are SSH destination and source ports identical (symmetric ports)?

When I connect to SSH I use port 22 as destination, but when the reply comes back, does it come in on port 22 as well? Or is the client source port randomly assigned as in other TCP communication?
If set up a firewall allowing outbound traffic to port 22 - Do I also need to allow incoming traffic on port 22?
The client SSH port is randomly assigned, as in most client/server systems over TCP/IP.
Were the client port fixed, you would not be able to open multiple SSH connections from the same client IP address, as the connections would be indistinguishable on an IP protocol level. The client port number is the only piece that makes the connection unique (client IP, server IP and server port being the same).
You do not need to allow the incoming traffic though. There is only one outgoing connection in SSH (the responses from the server come over an existing connection).

port number of HTTP server

I try to access the apache server on another machine (Even at localhost). I used
wireshark to get the port number of the packets which are random port number vs 80. This is correct.
But at the mean time, I tried to print out the port number at in the kernel myself at ip_rcv() which tcph->source and tcph->dest. It turned out that these two port numbers are
also random.
Not sure what I am doing wrong, can anybody tell me where I can get the correct port number from kernel?
You can't get the port number from any kernel, to set the port number for a Linux web-server do the following if you have apache:
If you have Apache, then go to /etc/apache2/ports.conf and change the 80 to a desired number of your choice
Then restart your server with service apache2 restart
Then in the web browser of your choice go to http://SERVER-IP:portnumber
NOTE: If you change the port number from 80 you must enter the new port number after the url/IP.