Skip to content

Commit

Permalink
add env var to set mac
Browse files Browse the repository at this point in the history
  • Loading branch information
ankudinov committed Aug 27, 2024
1 parent 5853ea5 commit 32e4fcc
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions containers/host-ubuntu/.devcontainer/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,10 @@ if [ "$TMODE" == 'lacp' ]; then
sudo ip link set eth1 master ${UPLINK}
sudo ip link set eth2 master ${UPLINK}

# RAND_HEX_1=$(openssl rand -hex 1)
# RAND_HEX_2=$(openssl rand -hex 1)
# BOND_MAC="c0:d6:82:00:${RAND_HEX_1}:${RAND_HEX_2}"
# ip link set dev ${UPLINK} address $BOND_MAC
sudo ip link set dev ${UPLINK} address "c0:d6:82:00:$(openssl rand -hex 1):$(openssl rand -hex 1)"
if [ -z "$UPLINK_MAC" ]; then
UPLINK_MAC="c0:d6:82:00:$(openssl rand -hex 1):$(openssl rand -hex 1)"
fi
sudo ip link set dev ${UPLINK} address "${UPLINK_MAC}"
sudo ip link set ${UPLINK} up

elif ! [ -z "${PHONE}" ] ; then
Expand All @@ -60,11 +59,10 @@ elif ! [ -z "${PHONE}" ] ; then
# Create br0
sudo ip link add name br0 type bridge

# RAND_HEX_1=$(openssl rand -hex 1)
# RAND_HEX_2=$(openssl rand -hex 1)
# BOND_MAC="30:86:2d:00:${RAND_HEX_1}:${RAND_HEX_2}"
# ip link set ${UPLINK} address $BOND_MAC
sudo ip link set dev ${UPLINK} address "30:86:2d:00:$(openssl rand -hex 1):$(openssl rand -hex 1)"
if [ -z "$UPLINK_MAC" ]; then
UPLINK_MAC="30:86:2d:00:$(openssl rand -hex 1):$(openssl rand -hex 1)"
fi
sudo ip link set dev ${UPLINK} address "${UPLINK_MAC}"

# Disable STP, provide add'l visibility
sudo ip link set ${UPLINK} type bridge stp_state 0
Expand Down

0 comments on commit 32e4fcc

Please sign in to comment.