Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for ip address

December 25, 2019

GCP Static IP

Create a static IP.

gcloud compute addresses create your-app-static-ip \
--region us-central1

gcloud compute addresses create your-app-static-ip \ --region us-central1

List static IP.

gcloud compute addresses list your-static-ip-name --region us-central1
# or
gcloud compute addresses list --filter="name=('live-tfc-static-ip-address')"

gcloud compute addresses list your-static-ip-name --region us-central1 # or gcloud compute addresses list --filter="name=('live-tfc-static-ip-address')"

Release static IP.

gcloud compute addresses delete your-app-static-ip \
--region us-central1

gcloud compute addresses delete your-app-static-ip \ --region us-central1

July 25, 2019

AWS EC2 Enable Secondary IPs

Here’s how to enable secondary private IPs for AWS EC2 instances.

  1. Add secondary private IPs to the instance.
    • Editing the instance Networking > Manage IP Addresses.
    • Add new private IP addresses.
    • Save.
  2. Set the route configuration for each secondary IP address.
    • Config files are ifcfg-eth0:0, ifcfg-eth:0.1 and so on.
    • Test each interface or IP to see if they respond to ping.
    • /etc/sysconfig/network-scripts/

ifcfg-eth0:0

NM_CONTROLLED="no"
DEVICE="eth0:0"
ONBOOT="yes"
BOOTPROTO="static"
IPADDR="10.0.0.14"
NETMASK="255.255.255.255"

NM_CONTROLLED="no" DEVICE="eth0:0" ONBOOT="yes" BOOTPROTO="static" IPADDR="10.0.0.14" NETMASK="255.255.255.255"

ifcfg-eth0:1

NM_CONTROLLED="no"
DEVICE="eth0:1"
ONBOOT="yes"
BOOTPROTO="static"
IPADDR="10.0.0.15"
NETMASK="255.255.255.255"

NM_CONTROLLED="no" DEVICE="eth0:1" ONBOOT="yes" BOOTPROTO="static" IPADDR="10.0.0.15" NETMASK="255.255.255.255"

July 7, 2019

Display Instance ID & IP Address

How to display IP address and Instance ID on web page behind a AWS load balancer.

Add these 2 commands in crontab. The job runs every 5 mins.

*/5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/instance-id > /var/www/html/id.txt
*/5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/public-ipv4 > /var/www/html/ip.txt

*/5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/instance-id > /var/www/html/id.txt */5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/public-ipv4 > /var/www/html/ip.txt

You can view on the site.

# your domain
http://yourdomain.com/ip.txt
http://yourdomain.com/id.txt
# your server ip address
http://1.1.1.1/ip.txt
http://1.1.1.1/id.txt

# your domain http://yourdomain.com/ip.txt http://yourdomain.com/id.txt # your server ip address http://1.1.1.1/ip.txt http://1.1.1.1/id.txt

  • « Previous Page
  • 1
  • 2
  • 3
  • Next Page »
  • Cloud
  • Linux
  • Git

Copyright © 2012–2021