shell get ip address netmask dns

shell.albert@yantai:~/temporary> /sbin/ifconfig  enp8s0 | awk '/HWaddr/{print $5}'
C8:0A:A9:2F:BE:7B
shell.albert@yantai:~/temporary> /sbin/ifconfig  enp8s0
enp8s0    Link encap:Ethernet  HWaddr C8:0A:A9:2F:BE:7B  
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
shell.albert@yantai:~/temporary> /sbin/ifconfig  wlp5s0 | awk '/inet addr:/{print $2}'|awk -F: '{print $2}'
192.168.3.106
shell.albert@yantai:~/temporary> /sbin/ifconfig wlp5s0
wlp5s0    Link encap:Ethernet  HWaddr 00:26:C7:24:28:F4  
          inet addr:192.168.3.106  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::226:c7ff:fe24:28f4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40545 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41291 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21620676 (20.6 Mb)  TX bytes:12678240 (12.0 Mb)

shell.albert@yantai:~/temporary> /sbin/ifconfig wlp5s0 | awk -F : '/Mask/{print $4}'
255.255.255.0
shell.albert@yantai:~/temporary> /sbin/ifconfig wlp5s0
wlp5s0    Link encap:Ethernet  HWaddr 00:26:C7:24:28:F4  
          inet addr:192.168.3.106  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::226:c7ff:fe24:28f4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:40731 errors:0 dropped:0 overruns:0 frame:0
          TX packets:41485 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:21646315 (20.6 Mb)  TX bytes:12714410 (12.1 Mb)

shell.albert@yantai:~/temporary> awk '/^nameserver/{print $2}' /etc/resolv.conf
202.106.196.115
202.106.0.20
shell.albert@yantai:~/temporary> cat /etc/resolv.conf
### /etc/resolv.conf file autogenerated by netconfig!
#
# Before you change this file manually, consider to define the
# static DNS configuration using the following variables in the
# /etc/sysconfig/network/config file:
#     NETCONFIG_DNS_STATIC_SEARCHLIST
#     NETCONFIG_DNS_STATIC_SERVERS
#     NETCONFIG_DNS_FORWARDER
# or disable DNS configuration updates via netconfig by setting:
#     NETCONFIG_DNS_POLICY=''
#
# See also the netconfig(8) manual page and other documentation.
#
# Note: Manual change of this file disables netconfig too, but
# may get lost when this file contains comments or empty lines
# only, the netconfig settings are same with settings in this
# file and in case of a "netconfig update -f" call.
#
### Please remove (at least) this line when you modify the file!
search china
nameserver 202.106.196.115
nameserver 202.106.0.20
shell.albert@yantai:~/temporary>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值