1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 |
#!/bin/bash
. fuctions.sh
echo "[*] ping 192.168.20.100"
ping -c 1 192.168.20.100 >/dev/null 2>&1
if [ $? -eq 0 ] ; then
print_good "[ OK ] Local Network Connection"
else
print_error "[ FAIL ] Local Network Connection"
cat <<- EOF
(1) VMware > Edit > Virtual Network Editor
(2) VMware > VM > Settings > Network Adapter
(3) # ifconfig
EOF
exit 1
fi
echo
echo "[*] ping 168.126.63.1"
ping -c 1 168.126.63.1 >/dev/null 2>&1
if [ $? -eq 0 ] ; then
print_good "[ OK ] External Netwrok Connection"
else
print_error "[ FAIL ] External Network Connection"
cat << EOF
(1) # netstat -nr (# route -n)
EOF
exit 2
fi
echo
echo "[*] nslookup www.daum.net"
nslookup www.daum.net | grep authoritative >/dev/null 2>&1
if [ $? -eq 0 ] ; then
print_good "[ OK ] DNS Client Configuration"
else
print_error "[ FAIL ] DNS Client Configuration"
cat << EOF
(1) # cat /etc/resolv.conf
EOF
exit 3
fi
|
cs |
1
2
3
4
5
6
7
8
9
10
11
12
13 |
# fuction.sh
function print_good () {
echo -e "\x1B[01;32m[+]\x1B[0m $1"
}
function print_error () {
echo -e "\x1B[01;31m[-]\x1B[0m $1"
}
function print_info () {
echo -e "\x1B[01;34m[*]\x1B[0m $1"
} |
cs |
반응형
'Linux > Shell Script' 카테고리의 다른 글
UID 번호 0번인 것들만 색출하는 스크립트 (0) | 2017.10.13 |
---|---|
파일이름 자동변경 스크립트 (0) | 2017.10.13 |
원격 관련 스크립트 (0) | 2017.10.13 |
인스톨 바 스크립트 (0) | 2017.10.13 |
핑테스트 스크립트 (0) | 2017.10.13 |