services-xbee_net/scripts/enable_host_macvlan.sh

19 lines
620 B
Bash
Executable File

#!/bin/bash
# Enable IP forwarding
sudo sysctl net.ipv4.ip_forward
# Delete the existing macvlan0 interface if it exists
if ip link show macvlan0 &> /dev/null; then
echo "Deleting existing macvlan0 interface..."
sudo ip link delete macvlan0
fi
# Create a new macvlan0 interface
echo "Creating macvlan0 interface..."
sudo ip link add link wlp0s20f3 macvlan0 type macvlan mode bridge
sudo ip addr add 192.168.1.100/24 dev macvlan0 # Use an IP in the same range as the container network but different from any assigned IP
sudo ip link set macvlan0 up
echo "macvlan0 interface created and set up successfully."