22 lines
785 B
Bash
22 lines
785 B
Bash
#!/bin/sh
|
|
|
|
if [ ! -e /etc/NetworkManager/system-connections/USB.nmconnection ]; then
|
|
# Create network connection
|
|
nmcli connection add con-name USB \
|
|
ifname usb0 \
|
|
type ethernet \
|
|
ip4 192.168.100.1/16
|
|
|
|
# Set priorities so it doesn't take precedence over WiFi/mobile connections
|
|
nmcli connection modify USB ipv4.route-metric 1500
|
|
nmcli connection modify USB ipv4.dns-priority 150
|
|
|
|
# Auto connection so it can be used for tethering
|
|
nmcli connection modify USB ipv4.method shared
|
|
nmcli connection modify USB connection.autoconnect yes
|
|
# nmcli con add con-name "modem" type "gsm" ifname "wwan0qmi0"
|
|
fi
|
|
|
|
# set up ip forward
|
|
sysctl -w net.ipv4.ip_forward=1
|
|
nmcli con up USB || true |