linux下的lan、网口、Ethernet通信

 时间:2026-02-16 11:17:38

1、首先我们关闭网络接口。

    # ifconfig eth0 inet down     

   # ifconfig     

   lo   Link encap:Local Loopback      

    ... (没有 eth0 这个条目了)     

    # route       ... (没有路由表了)

2、接下来我们启动 eth0 并给予其新的 IP 地址和路由。

    # ifconfig eth0 inet up 192.168.0.111 \                

   netmask 255.255.255.0 broadcast 192.168.0.255     

   # route add -net 10.0.0.0 netmask 255.0.0.0 gw 192.168.0.1 dev eth0

3、结果是:

    # ifconfig     

   eth0 Link encap:Ethernet  HWaddr 08:00:46:7A:02:B0          

            inet addr:192.168.0.111  Bcast:192.168.0.255  Mask:255.255.255.0             UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1          ...           

    lo   Link encap:Local Loopback         

           inet addr:127.0.0.1  Mask:255.0.0.0         

            ...     

    # route     

     Kernel IP routing table     

    Destination  Gateway      Genmask        Flags Metric Ref Use Iface             192.168.0.0  *            255.255.255.0  U     0      0     0 eth0     

     10.0.0.0     192.168.0.1  255.0.0.0      UG    0      0     0 eth0

  • 用身份证办的手机卡没注销怎么办
  • 金铲铲之战星守女团怎么玩
  • 如何查询国家政策信息
  • 五步学会朴素贝叶斯算法(Python版)
  • 建设银行龙卡通储蓄卡怎么激活?
  • 热门搜索
    什么运动最减肥 中级职称有什么用 什么动画片好看 校园运动会作文 zone是什么意思 relax什么意思 疼爱的近义词是什么 dde净量是什么意思 肝脏不好有什么症状 海藻糖是什么