Summary
Add gear_sonic_deploy/scripts/setup_network.py — a Python script for configuring a static IP on the workstation NIC to communicate with the Unitree G1 robot over the 192.168.123.x subnet.
Motivation
The existing setup scripts are shell-based and lack:
- Interactive interface discovery (lists all physical NICs with their state and current IP)
- Scoped firewall handling — adds a targeted
ufw rule per interface instead of disabling the firewall globally
- Pre-change config backup to
/tmp/network_backup_<timestamp>.txt
- Post-setup connectivity ping to verify the robot is reachable
- A
--interface flag for non-interactive/scripted use
What this script does
- Robot selection — interactive menu (currently supports Unitree G1; extensible via
ROBOT_CONFIGURATIONS dict)
- Interface discovery — enumerates physical NICs (skips loopback, Docker, veth, bridge interfaces), shows UP/DOWN state and current IP
- Config backup — saves existing IP/route state before making changes
- Static IP assignment — flushes existing addresses, brings the interface up, assigns
192.168.123.222/24 via iproute2
- Firewall — if
ufw is active, adds scoped allow in/out on <interface> rules (does not disable ufw globally)
- Connectivity check — pings the robot at
192.168.123.164 to confirm end-to-end reachability
Usage
# Interactive (prompts for robot type + interface)
python3 gear_sonic_deploy/scripts/setup_network.py
# Skip interface selection
python3 gear_sonic_deploy/scripts/setup_network.py -i enp5s0
Requirements
- Linux (Ubuntu 20.04 / 22.04 / 24.04)
iproute2, sudo privileges
ufw optional — skipped gracefully if not present
Files changed
gear_sonic_deploy/scripts/setup_network.py (new)
Branch
klakhi/setup_network_script on klakhi/GR00T-WholeBodyControl
Fixed by #238
Summary
Add
gear_sonic_deploy/scripts/setup_network.py— a Python script for configuring a static IP on the workstation NIC to communicate with the Unitree G1 robot over the192.168.123.xsubnet.Motivation
The existing setup scripts are shell-based and lack:
ufwrule per interface instead of disabling the firewall globally/tmp/network_backup_<timestamp>.txt--interfaceflag for non-interactive/scripted useWhat this script does
ROBOT_CONFIGURATIONSdict)192.168.123.222/24viaiproute2ufwis active, adds scopedallow in/out on <interface>rules (does not disable ufw globally)192.168.123.164to confirm end-to-end reachabilityUsage
Requirements
iproute2,sudoprivilegesufwoptional — skipped gracefully if not presentFiles changed
gear_sonic_deploy/scripts/setup_network.py(new)Branch
klakhi/setup_network_scripton klakhi/GR00T-WholeBodyControlFixed by #238