Linux 基础命令知识4

打印网络接口列表
 
 
  1. ifconfig | cut -c-10 | tr -d ' ' | tr -s '\n'
  2. eth0
  3. lo
  4. #cut -c-10 只取前10个字符 , tr -d '' 删除所有的空格 tr -s '\n' 合并换行符
  5. ifconfig eth0
  6. eth0 Link encap:Ethernet HWaddr 00:0c:29:8c:ff:7a
  7. inet addr:192.168.164.140 Bcast:192.168.164.255 Mask:255.255.255.0
  8. inet6 addr: fe80::20c:29ff:fe8c:ff7a/64 Scope:Link
  9. UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
  10. RX packets:4410 errors:5 dropped:7 overruns:0 frame:0
  11. TX packets:3018 errors:0 dropped:0 overruns:0 carrier:0
  12. collisions:0 txqueuelen:1000
  13. RX bytes:4268650 (4.2 MB) TX bytes:260426 (260.4 KB)
  14. Interrupt:19 Base address:0x2000
  15. #Hwaddr 为硬地址(Mac地址)
  16. #inet addr : IP地址
  17. #Bcast :广播地址
  18. #Mask : 子网掩码
  19. #设置网络接口Ip地址
  20. sudo ifconfig eth0 192.168.164.142
  21. #设置子网掩码
  22. sudo ifconfig eth0 netmask 225.225.225.0
  23. #设置硬件地址 ,在做MAC地址欺骗的时候可能会用上
  24. sudo ifconfig eth0 hw ether 00:1c:bf:87:25:d5
DNS查找
 
 
  1. #利用host 命令 或者 nslookup命令对域名进行解析
  2. host www.baidu.com
  3. www.baidu.com is an alias for www.a.shifen.com.
  4. www.a.shifen.com has address 119.75.217.109
  5. www.a.shifen.com has address 119.75.218.70
  6. nslookup www.baidu.com
  7. Server: 127.0.0.1
  8. Address: 127.0.0.1#53
  9. Non-authoritative answer:
  10. www.baidu.com canonical name = www.a.shifen.com.
  11. Name: www.a.shifen.com
  12. Address: 119.75.217.109
  13. Name: www.a.shifen.com
  14. Address: 119.75.218.70

查看路由表

 
 
  1. route
  2. Kernel IP routing table
  3. Destination Gateway Genmask Flags Metric Ref Use Iface
  4. 192.168.164.0 * 255.255.255.0 U 0 0 0 eth0
  5. #或者 -n选项用于展示数字形式地址
  6. route -n
  7. Kernel IP routing table
  8. Destination Gateway Genmask Flags Metric Ref Use Iface
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值