zoukankan      html  css  js  c++  java
  • Ubuntu固定多个静态ip

    步骤:

    1、sudo vim /etc/network/interfaces

      加入下列内容
      auto eth0#此处查看自己的ip信息是eth0还是eth1等等
      iface eth0 inet static
      address 192.168.xx.xx#设置要固定的ip1
      netmask 255.255.255.0
      gateway 192.168.xx.2    # 虚拟机中网关一般默认为2
      gateway 192.168.0.1         #在实体机中需要填写路由器的一般默认为这个  
      broadcast 192.168.10.255

       auto eth0:0#设置多个静态ip
      iface eth0:0 inet static
      address 192.168.xx.xx#设置要固定的ip2
      netmask 255.255.255.0
      gateway 192.168.xx.2    # 虚拟机中网关一般默认为2
      gateway 192.168.0.1         #在实体机中需要填写路由器的一般默认为这个(gateway选择一个
      broadcast 192.168.10.255

      auto eth0:1#设置多个静态ip
      iface eth0:1 inet static
      address 192.168.xx.xx#设置要固定的ip3
      netmask 255.255.255.0
      gateway 192.168.xx.2    # 虚拟机中网关一般默认为2
      gateway 192.168.0.1         #在实体机中需要填写路由器的一般默认为这个(gateway选择一个) 
      broadcast 192.168.10.255


    2. sudo vim /etc/NetworkManager/NetworkManager.conf

    将managed=false 改成true

    3.sudo vim /etc/resolvconf/resolv.conf.d/base

     

         加入nameserver为你的DNS即可

         nameserver 114.114.114.114

         nameserver 8.8.8.8

     4、ping域名进行测试

    yun@yun-virtual-machine:~$ ping www.baidu.com
    PING www.a.shifen.com (180.149.132.151) 56(84) bytes of data.
    64 bytes from 180.149.132.151: icmp_seq=1 ttl=128 time=30.7 ms
    64 bytes from 180.149.132.151: icmp_seq=2 ttl=128 time=32.5 ms
    64 bytes from 180.149.132.151: icmp_seq=3 ttl=128 time=33.1 ms
    64 bytes from 180.149.132.151: icmp_seq=4 ttl=128 time=37.7 ms
    64 bytes from 180.149.132.151: icmp_seq=5 ttl=128 time=33.0 ms
    64 bytes from 180.149.132.151: icmp_seq=6 ttl=128 time=31.3 ms

    5、为验证ip地址是否永久性,重启操作系统

          reboot

     

     

     

     

     

     

  • 相关阅读:
    [Aaronyang] 写给自己的WPF4.5 笔记[2依赖属性]
    [Aaronyang] 写给自己的WPF4.5 笔记[1布局]
    [AaronYang]C#人爱学不学[7]
    [AaronYang]C#人爱学不学[6]
    [AaronYang]C#人爱学不学[5]
    [AaronYang]C#人爱学不学[4]
    [AaronYang]C#人爱学不学[3]
    [AaronYang]C#人爱学不学[2]
    [AaronYang]C#人爱学不学[1]
    [aaronyang原创] Mssql 一张表3列的sql面试题,看你sql学的怎么样
  • 原文地址:https://www.cnblogs.com/yunwangjun-python-520/p/10065612.html
Copyright © 2011-2022 走看看