Linux下获取IP、MAC、网关、掩码的shell脚本

Mask:ifconfig |grep inet| sed -n '1p'|awk '{print $4}'|awk -F ':' '{print $2}'
IP:ifconfig |grep inet| sed -n '1p'|awk '{print $2}'|awk -F ':' '{print $2}'
mac:ifconfig |grep eth0|awk '{print $5}'
Linux下获取 设置IP、MAC、网关、掩码的shell脚本

cat /etc/resolv.conf | awk '{print $2}'
route -n | grep eth0 | grep UG | awk '{print $2}'

 

 

设置:

ifconfig eth0 10.0.192.79 netmask 255.255.254.0
route add default gw 10.0.193.254
echo 'nameserver 219.141.136.10' > /tmp/etc/resolv.conf

 

 

 自动获取ip:udhcpc -s /etc/dhcp.script 

相关文章:

  • 2022-12-23
  • 2021-06-08
  • 2021-04-01
  • 2022-12-23
  • 2021-05-25
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-18
  • 2022-12-23
  • 2022-12-23
  • 2021-05-15
  • 2021-11-12
  • 2022-02-08
  • 2021-12-03
相关资源
相似解决方案