Skip to content

Commit

Permalink
Add bridge config script for PL Server
Browse files Browse the repository at this point in the history
  • Loading branch information
Seshpenguin committed Mar 15, 2024
1 parent 622c8f0 commit 28eeef8
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
40 changes: 40 additions & 0 deletions distro-files/layout/opt/prolinux-server/setup-bridge.sh
@@ -0,0 +1,40 @@
#!/usr/bin/env bash

# First, let's stop NetworkManager to manually manage the network interfaces.
echo "Stopping NetworkManager..."
sudo systemctl stop NetworkManager

# Define the bridge interface name
bridgeInterface="br0"

# Check if the bridge interface already exists, if not, create it
if ! ip link show $bridgeInterface > /dev/null 2>&1; then
echo "Creating bridge interface $bridgeInterface"
ip link add name $bridgeInterface type bridge
else
echo "Bridge interface $bridgeInterface already exists"
fi

# Find all available network interfaces except the lo and the bridge itself
interfaces=$(ls /sys/class/net | grep -vE "lo|$bridgeInterface")

for i in $interfaces; do
# Exclude interfaces already part of a bridge
if [ ! -d "/sys/class/net/$i/bridge" ]; then
echo "Adding interface $i to bridge $bridgeInterface"
ip link set dev $i down
ip link set dev $i master $bridgeInterface
ip link set dev $i up
else
echo "Interface $i is already part of a bridge, skipping."
fi
done

# Bring up the bridge interface
ip link set dev $bridgeInterface up

# Configure the bridge interface for DHCP
echo "Setting up DHCP for $bridgeInterface..."
dhclient $bridgeInterface

echo "Bridge setup complete. Interfaces acting as a switch now!"
2 changes: 1 addition & 1 deletion src/index.ts
Expand Up @@ -137,7 +137,7 @@ async function main() {
pacman -S --noconfirm --needed xorg
# server related packages
pacman -S --noconfirm --needed podman podman-docker netavark aardvark-dns buildah
pacman -S --noconfirm --needed podman podman-docker netavark aardvark-dns buildah dhclient screen jq
Expand Down

0 comments on commit 28eeef8

Please sign in to comment.