🛠️
Ghoul's Den
WebsiteGhoulsec-Vault
  • Ghoul's Den
  • Index of Tools
  • Index of Links
  • Top Ports
  • Initial Environment Deployment
    • Python3 & Pip Installation
    • Docker 🛳
    • Setting up AWS CLI
    • Msfconsole
    • Netplan configuration & Cloudinit
    • Wordlist Generation - CEWL
    • Apache2 Server
  • Information Gathering & Recon Tools
    • GHDB : Google Hacking Database
    • Sherlock : Social Media Footprinting
    • Nslookup
    • Dig (Domain Information Groper)
    • Recon-ng
    • HTTrack & Web Data Extractor
    • Email Tracker Pro
    • Shodan
    • ARIN Website Registry
  • Network Scanning Enumaration & Vulnerability Detection Tools
    • NMAP & SuperENUM
    • Nmap
      • Target Specification
      • Host Discovery
      • Port Scanning Techniques
      • Port Specification & Scan Order
      • Service Version Detection
      • OS Detection
      • Nmap Scripting Engine
      • Timing & Performance
      • FW / IDS / IPS Evasion
      • Miscellaneous Options
    • Colasoft Packet Builder & Megaping
    • Global Network Inventory
    • LDAP Enumeration > Active Directory Explorer
    • NetBIOS Enumerator
    • SMBEagle
    • RPC Scan
    • Nikto - Web Application Scanner
    • Enum4Linux
  • File Sharing Enumeration
  • Cloud Computing
    • AAD Internals
    • AWS CLI & S3
    • Trivy Scanner
    • S3 Scanner
    • LazyS3
  • Cryptography & stegnography
    • Veracrypt
    • Cryptanalysis Tools
    • Whitespace Cryptography - Snow
    • Creating a Self signed certificate in IIS
    • Steghide & Stegcracker
    • snow
  • Wireless Attacks
    • Aircrack-ng
  • Mobile Attacks
    • PhoneSploit-Pro
    • AndroRAT
    • ADB
  • SQL Injection Vulnerability
    • SQLMap
    • DSSS
  • IOT & OT Hacking
  • Social Engineering
  • Honeypot & IDS
    • Cowrie Honeypot
  • Sniffing & DDos
    • Sniffing
      • Capturing Remote packets using Wireshark
      • Detecting Sniffing using Nmap
    • Denial of Service (Dos & DDos)
      • DDos Protection using DDos Guardian
  • Malware Attacks
  • Password Cracking & Windows exploitation tools
    • Hydra
    • John
    • Hashcat
    • CrackMapExec
    • Impacket
    • Powerview
    • BitsAdmin
    • Rubeus (Kerberoasting) & Winpeas
    • AD-DC Querying
    • mstsc - RDP
  • System hacking & buffer overflow
    • Responder
    • Reverse Shell Generator
    • Clearing Traces
  • Session Hijacking
    • Caido
    • Bettercap
  • Web Servers & Applications
  • Linux Fundamentals
    • Find Command
    • Grep Command
Powered by GitBook
On this page
  1. Initial Environment Deployment

Netplan configuration & Cloudinit

Cloud-init is a tool used to automate the initial configuration of a cloud instance (e.g., a virtual machine or server) during its first boot. It is widely used in cloud environments like AWS, Azure, and OpenStack to configure the operating system and software packages automatically.

Key tasks that Cloud-init can perform include:

  • Setting up networking (e.g., static IP addresses or DHCP)

  • Configuring users and groups (e.g., creating user accounts)

  • Installing and configuring software packages

  • Running custom scripts

  • Managing system settings like timezone, locale, etc.

Cloud-init reads configuration files (like YAML or scripts) and applies these settings to the instance automatically when it is first booted or during subsequent reboots, ensuring that the system is properly set up without manual intervention.


To resolve the issue where Cloud-init resets your Netplan configuration on reboot, follow these steps:

1. Disable Cloud-init's Network Configuration

You can disable Cloud-init's network configuration to prevent it from overwriting your Netplan file.

  1. Edit Cloud-init configuration:

    Open the file /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg (you may need to create this file if it doesn't exist) and add the following line:

    network: {config: disabled}

    This setting will tell Cloud-init to not touch the network configuration.

  2. Reboot or restart Cloud-init:

    After making the change, you can either reboot the machine or run:

    sudo cloud-init clean

    This will clear Cloud-init's data and allow it to re-run on the next boot without affecting the network config.

2. Modify the Netplan Configuration Directly

Make sure your /etc/netplan/*.yaml configuration files are correct and persistent. For example, if you want to use a static IP address, your 00-installer-config.yaml or another Netplan config file should look something like this:

network:
  version: 2
  renderer: networkd
  ethernets:
    enp3s0:
      dhcp4: false
      addresses:
        - 192.168.1.100/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
          - 8.8.8.8
          - 8.8.4.4

3. Ensure Netplan is Active

After editing the Netplan configuration, run the following command to apply it:

sudo netplan apply

This will ensure that your network settings are applied immediately.

4. Make Sure Cloud-init Does Not Revert Changes

If you want to prevent Cloud-init from overwriting the /etc/netplan configurations completely, you can stop Cloud-init from processing at all:

  1. Prevent Cloud-init from running network configuration:

    If you want to ensure Cloud-init never modifies anything related to the network, you can stop the network configuration part of Cloud-init altogether by disabling Cloud-init's networking config as described in step 1.

  2. You can also disable the Cloud-init service (but this is less recommended unless you are sure you don't need Cloud-init at all):

    sudo systemctl stop cloud-init
    sudo systemctl disable cloud-init

5. Check the Logs for Debugging

If you're still having issues, it’s useful to check the Cloud-init logs for any errors or messages related to the network configuration. You can find the logs at:

  • /var/log/cloud-init.log

  • /var/log/cloud-init-output.log

Look for messages indicating network configurations are being overwritten or any errors that might provide a clue.

Summary

  • Disable Cloud-init’s network config by adding network: {config: disabled} to /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg.

  • Modify the Netplan configuration to match your desired network settings.

  • Apply the changes using netplan apply.

  • Optionally, prevent Cloud-init from running entirely if it’s not needed on your system.


Completly removing cloud init configuration

PreviousMsfconsoleNextWordlist Generation - CEWL

Last updated 4 months ago