zoukankan      html  css  js  c++  java
  • network ifconfig

    linux ifconfig可用于设置网络设备的状态,或是显示目前的设置。

    ifconfig 的常见用法:

    显示网络设备信息
      # ifconfig        
      eth0   Link encap:Ethernet HWaddr 00:50:56:0A:0B:0C 
           inet addr:192.168.0.3 Bcast:192.168.0.255 Mask:255.255.255.0
           inet6 addr: fe80::250:56ff:fe0a:b0c/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
           RX packets:172220 errors:0 dropped:0 overruns:0 frame:0
           TX packets:132379 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:87101880 (83.0 MiB) TX bytes:41576123 (39.6 MiB)
           Interrupt:185 Base address:0x2024 
    启动关闭指定网卡
      # ifconfig eth0 down
      # ifconfig eth0 up
    为网卡配置和删除IPv6地址
      # ifconfig eth0 add 33ffe:3240:800:1005::2/ 64 //为网卡设置IPv6地址
      # ifconfig eth0 del 33ffe:3240:800:1005::2/ 64 //为网卡删除IPv6地址
    修改MAC地址
      # ifconfig eth0 down //关闭网卡
      # ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //修改MAC地址
      # ifconfig eth0 up //启动网卡
      ​
      # ifconfig eth1 hw ether 00:1D:1C:1D:1E //关闭网卡并修改MAC地址 
      # ifconfig eth1 up //启动网卡
    配置IP地址
      # ifconfig eth0 192.168.1.56  //给eth0网卡配置IP地址
      # ifconfig eth0 192.168.1.56 netmask 255.255.255.0 // 给eth0网卡配置IP地址,并加上子掩码
      # ifconfig eth0 192.168.1.56 netmask 255.255.255.0 broadcast 192.168.1.255 // 给eth0网卡配置IP地址,加上子掩码,加上个广播地址
    启用和关闭ARP协议
      # ifconfig eth0 arp  //开启
      # ifconfig eth0 -arp  //关闭
    设置最大传输单元
      # ifconfig eth0 mtu 1500 //设置能通过的最大数据包大小为 1500 bytes

     

  • 相关阅读:
    Python(一)-基础不牢,地动山摇
    微信公众号开启企业付款到用户
    CSS多行显示省略号
    angular service自定义返回
    CSS input radio和checkbox样式
    angular微信支付url未注册
    angular+ionic的兼容性问题
    js 字符串和16进制的互相转换
    js循环变量赋值
    CSS 两层实现垂直居中(外层固定宽高,内层文本不定行数)
  • 原文地址:https://www.cnblogs.com/tongyishu/p/13816941.html
Copyright © 2011-2022 走看看