services-xbee_net/scripts/setup_end_device.sh

17 lines
677 B
Bash
Executable File

# Configure xbnet on remote device
sudo xbnet \
/dev/ttyUSB0 \ # Port where the XBee device is connected \
tun # Create a TUN (network tunnel) interface for routing IP packets
sudo ip addr \
add 192.168.100.2/24 \ # Assign the IP address 192.168.100.2 with a subnet mask of 255.255.255.0 \
dev xbnet1 # to the xbnet1 interface
sudo ip link \
set dev xbnet1 up # Activate the xbnet1 interface
# Add default route to use host machine as gateway
sudo ip route \
add default \ # Add a default route for all outgoing traffic \
via 192.168.100.1 # Use 192.168.100.1 (the host machine) as the gateway