Skip to content

Commit 58e76ef

Browse files
deepaks2krishnajs
andauthored
Adding script to apply custom network attachment definition for secondary interface (#107)
Signed-off-by: S, Deepak <[email protected]> Co-authored-by: Krishnamurthy Jambur <[email protected]>
1 parent 989269f commit 58e76ef

File tree

3 files changed

+874
-0
lines changed

3 files changed

+874
-0
lines changed

standalone-node/docs/user-guide/desktop-virtualization-cloud-init.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,22 @@ write_files:
5959
content: |
6060
SUBSYSTEM=="usb", MODE="0664", GROUP="qemu"
6161
62+
- path: /etc/cloud/custom_network.conf
63+
permissions: '0644'
64+
content: |
65+
# custom_network.conf
66+
# Update this file to specify custom network settings for the bridge configuration script.
67+
# Set the CIDR, gateway, netmask, IP range, and DNS server for your environment.
68+
# If EdgeNode cannot reach Internet. DNS update needed.
69+
70+
BR_NAME="br0" # Bridge interface name
71+
BR_CIDR="199.168.1.0/24" # Bridge interface IP address and subnet (CIDR notation)
72+
BR_GATEWAY="199.168.1.1" # Default gateway for the bridge network
73+
BR_NETMASK="24" # Netmask for the bridge network (as a number, e.g., 24)
74+
BR_START_RANGE="199.168.1.2" # Start of the DHCP/static IP range for clients
75+
BR_END_RANGE="199.168.1.20" # End of the DHCP/static IP range for clients
76+
BR_DNS_NAMESERVER="8.8.8.8" # DNS server to use for the bridge network.
77+
6278
# === Custom run commands ===
6379
# List commands or scripts to run at boot.
6480
# Note : Make sure syntax is correct for the commands,if any issues in commands error messages will be present
@@ -67,9 +83,15 @@ write_files:
6783
# runcmd:
6884
# - systemctl restart myservice
6985
# - bash /etc/cloud/test.sh
86+
# If custom scripts in user-apps are getting not getting invoked. please make sure to add the scripts in "user-apps" folder
87+
# Example:
88+
# runcmd:
89+
# - bash /opt/user-apps/network-config.sh /etc/cloud/custom_network.conf
7090
runcmd:
7191
- echo $(( 6 * 1024 * 4 )) | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
7292
- systemctl --user enable idv-init.service
7393
- udevadm control --reload-rules
94+
- test -f /opt/user-apps/network_config.sh && bash /opt/user-apps/network_config.sh /etc/cloud/custom_network.conf || echo "network_config.sh is missing"
95+
- test -f /opt/user-apps/apply_bridge_nad.sh && bash /opt/user-apps/apply_bridge_nad.sh /etc/cloud/custom_network.conf > /etc/cloud/apply_bridge_nad.log 2>&1 & || echo "apply_bridge_nad.sh is missing"
7496

7597
```

0 commit comments

Comments
 (0)