shell get ip address netmask dns

来源:互联网 发布:打车软件除了滴滴 编辑:程序博客网 时间:2024/05/29 11:09
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
原创粉丝点击