Notice
Recent Posts
Recent Comments
Link
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- GLBP
- DHCP
- ripng
- tunneling
- 스위치
- rip
- Redistribute
- Etherchannel
- 헤더
- 명령어
- ACL
- Chrony
- 라우터
- vrrp
- ipv6
- NAT
- OSI 7 layer
- Vlan
- Inter VLAN
- ospfv3
- eigrpv2
- eigrp
- stp
- OSPF
- crontab
- CKA
- 장비
Archives
- Today
- Total
Net Eng
ipconfig.sh 본문
#!/bin/bash
# (1) Host Name
# (2) Connection Name
# (3) Ethernet Adapter
# (4) IPv4 Address
# (5) Defalt Gateway
# (6) DNS Servers
# (0) Variavle definition
export LANG=en_US.UTF-8
TMP1=/tmp/tmp1
# (1) Host Name
HOST=$(hostname)
echo
echo "Host Name ............ : $HOST"
# (2) Connection Name
nmcli -f NAME connection | tail -n +2 > $TMP1
for CON in $(cat $TMP1)
do
# (3) Ethernet Adapter
NIC=$(echo $(nmcli connection show $CON | grep "connection.interface-name:" | awk '{print $2}'))
# (4) IPv4 Address
IP1=$(echo $(nmcli connection show $CON | grep "ipv4.addresses:" | awk '{print $2}'))
# (5) Defalt Gateway
GW1=$(echo $(nmcli connection show $CON | grep "ipv4.gateway:" | awk '{print $2}'))
# (6) DNS Servers
DNS1=$(echo $(nmcli connection show $CON | grep "ipv4.dns:" | awk '{print $2}'))
# (7) Output
cat << EOF
Connection Name ...... : $CON
Ethernet adapter ..... : $NIC
IPv4 Address ......... : $IP1
Default Gateway ...... : $GW1
DNS Servers .......... : $DNS1
EOF
done'Language > Shell Script' 카테고리의 다른 글
| check_network.sh (0) | 2024.06.08 |
|---|---|
| calculator.sh (0) | 2024.06.08 |
| check_service.sh (0) | 2024.06.08 |
| auto_telnet_ftp.sh (0) | 2024.06.08 |
| check_file.sh (0) | 2024.06.08 |