首页 > 代码库 > shell脚本查看网络配置

shell脚本查看网络配置

#!/bin/bash
ifconfig|grep -E 'eth|inet'|grep -Ev '(inet6|127.0.0.1)'|sed 's/ /\n/g'|awk NF|grep -Ev '(inet|encap|Link|HWaddr)'|sed 's/00:/MAC:/g';route|grep default|awk '{print "\nGATEWAY:"$2}'
cat /etc/resolv.conf|grep nameserver|awk '{print "DNS:"$2}'

shell脚本查看网络配置