From 61a8dfdb1e8f0f025a0a842a6237569f19a643d8 Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 16 Dec 2021 00:30:00 +0800 Subject: [PATCH] add route script --- scripts/add_cn_ip_route_linux.sh | 5254 ++++++++++++++++++++++++++++++ 1 file changed, 5254 insertions(+) create mode 100755 scripts/add_cn_ip_route_linux.sh diff --git a/scripts/add_cn_ip_route_linux.sh b/scripts/add_cn_ip_route_linux.sh new file mode 100755 index 0000000..86f15ae --- /dev/null +++ b/scripts/add_cn_ip_route_linux.sh @@ -0,0 +1,5254 @@ +#!/bin/sh + +OP="add" +GATEWAY=$(ip route show 0/0 | head -n1 | grep 'via' | grep -o '[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+') +DEVICE=$(ip route show 0/0 | head -n1 | grep 'via' | grep -o '\(ens\|enp\|enx\|eth\|en0\|wlan\|wlp\)[A-Za-z0-9]\+') + +echo $OP $GATEWAY $DEVICE + +ip -batch - <