update rip
This commit is contained in:
parent
21a9c4d5eb
commit
38c65fd5dc
36
linux/rip
36
linux/rip
@ -1,13 +1,39 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
chan=pride
|
chan=$1
|
||||||
chan_pre=$chan'_pre'
|
chan_pre=$chan'_pre'
|
||||||
chan_forward=$chan'_forward'
|
chan_forward=$chan'_forward'
|
||||||
chan_post=$chan'_post'
|
chan_post=$chan'_post'
|
||||||
to=192.168.122.245
|
from=$2
|
||||||
to_port=3389
|
from_port=$3
|
||||||
from=10.69.115.207
|
to=$4
|
||||||
from_port=19520
|
to_port=$5
|
||||||
|
|
||||||
|
if ! [ -e "$1" ]; then
|
||||||
|
echo "iptable chan not found" >&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -e "$2" ]; then
|
||||||
|
echo "from host not found" >&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if ! [ -e "$3" ]; then
|
||||||
|
echo "from port not found" >&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -e "$4" ]; then
|
||||||
|
echo "destination host not found" >&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! [ -e "$5" ]; then
|
||||||
|
echo "destination port not found" >&1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "redirect ${from}:${from_port} to ${to}:${to_port}"
|
||||||
|
|
||||||
## 清空 引用
|
## 清空 引用
|
||||||
sudo iptables -t nat -nvL PREROUTING --line-number | awk -F ' ' 'BEGIN{c=0} /'${chan_pre}'/ {printf "%s %s %s\n",c, $1,$4;system("sudo iptables -t nat -D PREROUTING "$1-c);c++}'
|
sudo iptables -t nat -nvL PREROUTING --line-number | awk -F ' ' 'BEGIN{c=0} /'${chan_pre}'/ {printf "%s %s %s\n",c, $1,$4;system("sudo iptables -t nat -D PREROUTING "$1-c);c++}'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user