Showing posts with label ip. Show all posts
Showing posts with label ip. Show all posts

February 19, 2020

Nginx Load Balancing Configuration

Hi folks,

I am going to explain the process of load balancing the web application using Nginx

Pre-requisites


  • One machine with Nginx installation
  • Two machines with running the same web application

Test setup

All are Ubuntu server machines

  1. 10.10.1.1 - Load Balancer
  2. 10.10.1.2 - Node 1
  3. 10.10.1.3 - Node 2



Configuration

In the Nginx server machine (10.10.1.1) do the following load balancing configuration


  • Make sure you stop the nginx server if running

$ sudo service nginx stop

  • Edit the nginx.conf file 

$ sudo vi /etc/nginx/nginx.conf

  • Place the following sample content

http {
        upstream testsetup {
        server 10.10.1.2;
        server 10.10.1.3;
}
    server{
        listen 8090;
        server_name testsetup;
        location / {
            proxy_pass http://testsetup;
        }
    }
}

  • Start the Nginx server

$ sudo service nginx start

Load Balancing Test


  1. Access the 10.10.1.1:8090 in the web browser
  2. It will redirect to Node 1 (10.10.1.2)
  3. Refresh/Reload the page, the load balancer redirects to Node 2 (10.10.1.3)

Tip

To differentiate the web server, add a footer with different content (Static IP Address) in your index.html


Please send your comments and feedback to psrdotcom@gmail.com

October 31, 2014

Change IP Address and DNS from static to DHCP and vice versa in Windows Command Line Dynamically using Batch file script

Hi friends,

I was frequently changing my system network from static to dynamic.

I was fed-up with the manual changes by entering the static IP address and changing it to dynamic.

I though of creating a batch file, which requests user to select options and proceed further.

 

I found something on Internet, just modified it for my purpose and thought of sharing with you all.

 

  • Check your network name
    • cmd> netsh interface show interface
  • It will list all the network interfaces connected to your system
    • Select the network which you want to change the settings
  • Modify the below code with appropriate network name, IP address, subnet, gateway and DNS server

@echo off

set NETWORK="Local Area Connection"
set IP=10.9.40.95
set SUBNET=255.255.255.0
set GATEWAY=10.9.40.47
set DNSSERVER=192.168.178.1

echo Choose:
echo [S] Set Static IP
echo [D] Set DHCP
echo.

:choice
SET /P C=[S,D]?
for %%? in (S) do if /I "%C%"=="%%?" goto S
for %%? in (D) do if /I "%C%"=="%%?" goto D
goto choice

:S
@echo off
echo "Setting Static IP Address, Subnet Mask and DNS Server"
netsh interface ip set address %NETWORK% static %IP% %SUBNET% %GATEWAY% 1
netsh interface ip set dnsservers %NETWORK% static %DNSSERVER% primary
netsh interface ip show config
pause
goto end

:D
@echo off
echo "Resetting IP Address, Subnet Mask and DNS server For DHCP"
netsh interface ip set address name=%NETWORK% dhcp
netsh interface ip set dns %NETWORK% dhcp
ipconfig /renew

echo "New IP Address, Subnet Mast and DNS Server for %computername%:"
netsh interface ip show config
pause
goto end

:end

Now enjoy the feature of changing IP address with 3 clicks

 

Please send your feedback and comments to psrdotcom@gmail.com

Blogger Labels: Change,DHCP,vice,Windows,Command,Line,Batch,script,system,user,options,Internet,purpose,Check,interface,interfaces,Select,settings,Modify,gateway,server,NETWORK,Local,Area,Connection,SUBNET,DNSSERVER,Choose,Static,Mask,Mast,feedback,netsh,goto,config

August 14, 2014

Finding IP address to MAC and vice versa on same network (subnet) or different subnet which is reachable by ping

Hi all,

After long time I got a chance to write the blog.

 

This time it is related to networking.

 

Finding out which all the system up on the network

Syntax

cmd> nmap –sP < regex IP >

Example

cmd> nmap –sP 192.168.1.*

 

Finding MAC address of a device which is connected in same network

Syntax

cmd> ping <broadcast address>

cmd> arp –a [ <IP address> ]

 

Example

cmd> ping 192.168.1.255

cmd> arp –a –> Gives all the IP address and MAC address in the same subnet network

cmd> arp –a 192.168.1.25 –> Give the MAC of the specified IP address

 

arp –a : Lists all the IP addresses which are recently got into network with its MAC addresses

 

Finding MAC address of a device which is connected in same network but different subnet

Syntax

nbtstat –A <IP address>

Example

nbtstat –A 192.168.2.45

 

Please send your comments and feedback to psrdotcom@gmail.com

Featured Post

Java Introdcution

Please send your review and feedback to psrdotcom@gmail.com