shell获取本地网卡IP,mac,掩码,dns,外网IP
来源:互联网 发布:ps美工招聘兼职 编辑:程序博客网 时间:2024/06/07 21:04
#/usr/bin/env bash
# Name: get_network_info.sh
# Author: Purple_Grape
# This is a script to gather network information of your Linux system.
# Test under Ubuntu 10.04 only.
#----------------------------
NIC=eth0
MAC=`LANG=C ifconfig $NIC | awk '/HWaddr/{ print $5 }' `
IP=`LANG=C ifconfig $NIC | awk '/inet addr:/{ print $2 }' | awk -F: '{print $2 }'`
MASK=`LANG=C ifconfig $NIC | awk -F: '/Mask/{print $4}'`
ext_ip=`curl ifconfig.me`
if [ -f /etc/resolv.conf ];
then
dns=`awk '/^nameserver/{print $2}' /etc/resolv.conf `
fi
#----------------------------
echo "Your network information is as below:"
echo $MAC
echo $IP
echo $dns
echo $ext_ip
# Name: get_network_info.sh
# Author: Purple_Grape
# This is a script to gather network information of your Linux system.
# Test under Ubuntu 10.04 only.
#----------------------------
NIC=eth0
MAC=`LANG=C ifconfig $NIC | awk '/HWaddr/{ print $5 }' `
IP=`LANG=C ifconfig $NIC | awk '/inet addr:/{ print $2 }' | awk -F: '{print $2 }'`
MASK=`LANG=C ifconfig $NIC | awk -F: '/Mask/{print $4}'`
ext_ip=`curl ifconfig.me`
if [ -f /etc/resolv.conf ];
then
dns=`awk '/^nameserver/{print $2}' /etc/resolv.conf `
fi
#----------------------------
echo "Your network information is as below:"
echo $MAC
echo $IP
echo $dns
echo $ext_ip
0 0
- shell获取本地网卡IP,mac,掩码,dns,外网IP
- Linux下获取IP、MAC、网关、掩码的shell脚本
- Linux下获取IP、MAC、掩码的shell脚本
- shell 通过IP 掩码 获取网络号
- 上网原理大透析(MAC,IP,掩码,DNS)
- linux ip 网关 掩码 mac 路由 dns设置方法
- VC++ 获取网卡IP、DNS、适配器名称
- shell 获取本地IP地址
- Qt获取IP地址、MAC地址等网卡信息,区分本地网卡、无线网卡和虚拟网卡
- python3 linux 下获取本地网卡ip
- 获取网卡IP与MAC地址
- java通过ip获取网卡MAC地址
- win7 修改IP,网关,DNS,掩码
- IE下通过javascript如何获取本地网卡IP,MAC地址,计算机名
- C语言获取本地所有网卡的ip地址及MAC信息
- Linux下通过shell获取网卡的ip地址和mac地址
- Linux下通过shell获取网卡的ip地址和mac地址
- shell 获取网卡IP地址 子网掩码 默认网关 广播地址 MAC地址
- C++解析JSON
- Javascript权威指南学习笔记--Jquery类库
- 一些零碎的ios知识点 ~
- 最佳日志实践(荐)
- 推荐好友和共同好友sql
- shell获取本地网卡IP,mac,掩码,dns,外网IP
- VC模拟输入中文
- android之service
- POJ 2109 少见多怪,利用double log pow 解决高精度
- EditPlus等编辑器选中列(块)的方法
- MVC3学习:将excel文件导入到sql server数据库
- 重装系统后ORACLE的恢复
- DOM应用---遍历网页中的元素
- log4j.xml示例