zoukankan      html  css  js  c++  java
  • Ubuntu配置网卡IP地址

    Ubuntu Desktop14.04  ,在window7 下的vmware14虚拟机中

    cat  /etc/network/interfaces

    默认已经有lo: 系统给定的网络回环接口

    eth0的配置(Ubuntu Desktop14.04)

    1.  cd  /etc/network

        vim  interfaces

    2.  键入如下命令:

        auto  eth0

        iface  eth0  inet  static

        address  192.168.1.1

        netmask  255.255.255.0

        network  192.168.1.0

        gateway  192.168.1.254

        broadcast  192.168.1.255

    3.  添加另一块网卡eth1

        auto  eth1

        iface  eth1  inet  static

        address  192.168.1.10

        netmask  255.255.255.0

        network  192.168.1.0

        gateway  192.168.1.254

        broadcast  192.168.1.255

    :wq 存盘退出

    4.  重新启动网络服务:

        sudo  /etc/init.d/networking  restart

    5.  使eth1生效,激活eth1

        ifup  eth1

    6.  开启网内的访问权限:

       sudo  ufw  allow  from  192.168.1.250/24

                                      说明:192.168.1.250为另一台ubuntu server 16.04的IP地址

    7.  切换到ubuntu server 16.04虚拟机上,输入命令:

       sudo  ufw  allow  from  192.168.1.10/24

                                      说明:192.168.1.10是ubuntu desktop上刚添加的网卡eth1的IP地址

    8. 两台虚拟机均重新启动

    9.  从ubuntu server服务器ping 客户端ubuntu desktop

        ping  192.168.1.10    连通   

        从ubuntu desktop客户端ping 服务器ubuntu server

        ping  192.168.1.250. 连通

    10.  修改客户端ubuntu desktop的eth0的IP地址:

         ifconfig  eth0  192.168.1.100  netmask  255.255.255.0

         再看一下是否被修改

         ifconfig  -a

    11.  使修改后的IP地址生效:

        ifconfig  eth0  up

        互相ping   仍然可以ping通

  • 相关阅读:
    次小生成树
    [bzoj5329] P4606 [SDOI2018]战略游戏
    CF487E Tourists
    P3225 [HNOI2012]矿场搭建
    CF #636 (Div. 3) 对应题号CF1343
    P3469 [POI2008]BLO-Blockade
    大假期集训模拟赛12
    大假期集训模拟赛11
    大假期集训模拟赛10
    小奇画画——BFS
  • 原文地址:https://www.cnblogs.com/duanqibo/p/11209465.html
Copyright © 2011-2022 走看看