Fixed ip address for outbound connections

  • Thread starter Thread starter fibergeek
  • Start date Start date
  • Replies Replies 4
  • Views Views 1,417
Messages
1
Location
Hyderabad
ISP
Jio Fiber
I'm trying to access an ip restricted server from the reliance jio fiber connection at home. Several VMs are accessing these services from my home connection. To access these services, I need to whitelist my ipv4 address. As you all know we don't have a static IP on the normal jio fiber connection.

Is there any solution to get a fixed ip for outbound connections?
 
I encountered a similar issue myself. My secure DNS server is hosted in Azure, and access is limited to the public IP assigned to my Jio Home Gateway. Each time the Jio Home Gateway router reboots, there's a potential for all connected devices in my home to lose internet access due to DNS-related problems. To address this, I've employed my TP-Link router to establish dynamic DNS using no-ip.org. Additionally, I crafted a PowerShell script to promptly update my NSG rule in Azure whenever my Jio Router's IP changes. So far, this solution has been working impeccably.

This approach represents how I tackled my own issue. I'm unsure of your network configuration or how you access these services, but you might find this method helpful to explore potential solutions.
 
Shouldn't a smarter thing to do is to create an IPSEC/VPN tunnel and route the traffic for your VMs as required?

If your restricted/DC IP is unmanaged, then creating a jump server will be convenient.
 
Code:
$OldGatewayIP = Get-Content  "/home/azureuser/iplog.txt"
$HomeGatewayIP = $([Net.DNS]::GetHostEntry("gateway.technochat.in")).AddressList.IPAddressToString
if ($HomeGatewayIP -ne $OldGatewayIP)
{
    $tenantID = "TenentID"
    $clientId = "ClientID"
    $clientPassword = "ClientPassword"
    $userPassword = ConvertTo-SecureString -String $clientPassword -AsPlainText -Force
    $AzureRMCred = New-Object -TypeName System.Management.Automation.PSCredential($clientID, $userPassword)
    Connect-AzAccount -ServicePrincipal -Credential $AzureRMCred -Tenant "TenentID"
    Set-AzContext -Subscription "YourSubID" -Tenant "YourTenentID"


    $nsgName = "DockerIN-nsg"
    $resourceGroupName = "Docker-Lab-Cen-India"
    $rule_name = @("AllowAnyDNS-TCPInbound","AllowCidrBlockDNS-UDPInbound","SSH")
    $nsg = Get-AzNetworkSecurityGroup -Name $nsgName -ResourceGroupName $resourceGroupName
    $rule= $nsg | Get-AzNetworkSecurityRuleConfig -Name $rule_name[0]
    Set-AzNetworkSecurityRuleConfig -NetworkSecurityGroup $nsg `
         -Name $rule_name[0] `
         -Access $rule.Access `
         -Protocol $rule.Protocol `
         -Direction $rule.Direction `
         -Priority $rule.Priority `
         -SourceAddressPrefix $HomeGatewayIP `
         -SourcePortRange $rule.SourcePortRange `
         -DestinationAddressPrefix $rule.DestinationAddressPrefix `
         -DestinationPortRange $rule.DestinationPortRange
    $nsg | Set-AzNetworkSecurityGroup

    $nsg = Get-AzNetworkSecurityGroup -Name $nsgName -ResourceGroupName $resourceGroupName
    $rule= $nsg | Get-AzNetworkSecurityRuleConfig -Name $rule_name[1]
    Set-AzNetworkSecurityRuleConfig -NetworkSecurityGroup $nsg `
         -Name $rule_name[1] `
         -Access $rule.Access `
         -Protocol $rule.Protocol `
         -Direction $rule.Direction `
         -Priority $rule.Priority `
         -SourceAddressPrefix $HomeGatewayIP `
         -SourcePortRange $rule.SourcePortRange `
         -DestinationAddressPrefix $rule.DestinationAddressPrefix `
         -DestinationPortRange $rule.DestinationPortRange
    $nsg | Set-AzNetworkSecurityGroup

    $nsg = Get-AzNetworkSecurityGroup -Name $nsgName -ResourceGroupName $resourceGroupName
    $rule= $nsg | Get-AzNetworkSecurityRuleConfig -Name $rule_name[2]
    Set-AzNetworkSecurityRuleConfig -NetworkSecurityGroup $nsg `
         -Name $rule_name[2] `
         -Access $rule.Access `
         -Protocol $rule.Protocol `
         -Direction $rule.Direction `
         -Priority $rule.Priority `
         -SourceAddressPrefix $HomeGatewayIP `
         -SourcePortRange $rule.SourcePortRange `
         -DestinationAddressPrefix $rule.DestinationAddressPrefix `
         -DestinationPortRange $rule.DestinationPortRange
    $nsg | Set-AzNetworkSecurityGroup

    $HomeGatewayIP > "/home/azureuser/iplog.txt"
}
else
{
    Write-Host "No changes detected."
}
 
Back