Skip to content

Instantly share code, notes, and snippets.

@muratgozel
Created September 6, 2018 18:50
Show Gist options
  • Save muratgozel/5901700de605bc41397f45eb5e85eeb7 to your computer and use it in GitHub Desktop.
Save muratgozel/5901700de605bc41397f45eb5e85eeb7 to your computer and use it in GitHub Desktop.
Which IP address is nginx or apache using while making outbound request?
# 1. Option: From the Terminal
# Get internal ip addresses
hostname -I
# Get the ip address which is starting with 10.XXX.XXX.XXX from the output.
# And place it in the command below.
wget --bind-address=10.XXX.XXX.XXX https://example.com
# 2. Option: From the shell script
#!/bin/bash
hostnames=$(hostname -I);
anchor_ip=$([[ "$hostnames" =~ 10\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3} ]] && echo $BASH_REMATCH);
wget --bind-address=10.XXX.XXX.XXX https://example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment