mirror of
https://github.com/femtofox/femtofox.git
synced 2026-11-26 09:56:32 -05:00
Create networkinterfaces.sh
This commit is contained in:
parent
27496d263e
commit
f5196fd008
1 changed files with 27 additions and 0 deletions
27
scripts/networkinterfaces.sh
Normal file
27
scripts/networkinterfaces.sh
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Generate a random unicast MAC address
|
||||
random_mac=$(printf '%02X:%02X:%02X:%02X:%02X:%02X\n' \
|
||||
$(( (RANDOM % 256) & 0xFE )) $(( RANDOM % 256 )) $(( RANDOM % 256 )) \
|
||||
$(( RANDOM % 256 )) $(( RANDOM % 256 )) $(( RANDOM % 256 )))
|
||||
|
||||
# Define the configuration to append
|
||||
config="
|
||||
auto lo
|
||||
iface lo inet loopback
|
||||
|
||||
# static mac address for onboard ethernet (castellated pins)
|
||||
allow-hotplug eth0
|
||||
iface eth0 inet dhcp
|
||||
hwaddress ether $random_mac
|
||||
|
||||
allow-hotplug wlan0
|
||||
iface wlan0 inet dhcp
|
||||
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
|
||||
"
|
||||
|
||||
# Append the configuration to /etc/network/interfaces
|
||||
echo "$config" >> /etc/network/interfaces
|
||||
|
||||
# Output the generated MAC address
|
||||
echo "Appended configuration with generated MAC address: $random_mac"
|
||||
Loading…
Add table
Add a link
Reference in a new issue