myyou
V2EX  ›  Ubuntu

ubuntu 14.04 如何设置静态 ip?

  •  
  •   myyou · Jun 29, 2016 · 4634 views
    This topic created in 3790 days ago, the information mentioned may be changed or developed.

    安装在 vmware 12 里的 ubuntu14.04 64 位,网络模式使用桥接,按照该博客(链接: http://www.cnblogs.com/vincedotnet/p/4013099.html )提供的方法设置静态 ip 后,无法 ssh 登陆,请问该如何设置静态 ip ?

    8 replies  •  2016-06-29 16:46:57 +08:00
    ICU
    ICU
    Jun 29, 2016
    1
    在 Ubuntu 中装 ssh 了吗?
    myyou
    myyou
    OP
    Jun 29, 2016
    2
    @ICU 装了,只是按照那个博客设置后,无法 ssh 登陆
    zjj2008se
    zjj2008se
    Jun 29, 2016 via Android
    3
    sudo apt-get install openssh-server
    kozora
    kozora
    Jun 29, 2016❤️1
    4
    网络模式使用直接复制物理模式
    然后在 /etc/network/interfaces 修改
    我把我的例子给你看看
    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto 网卡名
    iface 网卡名 inet static
    address 192.168.1.3
    netmask 255.255.255.0
    network 192.168.1.1
    broadcast 192.168.2.255
    gateway 192.168.1.1
    dns-nameservers 223.5.5.5 223.6.6.6
    zh10086
    zh10086
    Jun 29, 2016
    5
    你看下你能否 ping 外网,你本地连接网络是不是 wifi 连接, wifi 连接的 vm 貌似不能设置静态 ip ,检查 ssh 的端口是不是默认的 22 ,检查防火墙是否开启
    ICU
    ICU
    Jun 29, 2016❤️1
    6
    解决了没,要不试一下动态的 与楼上那位兄弟的一样的修改方法:
    在 /etc/network/interfaces 修改

    # This file describes the network interfaces available on your system
    # and how to activate them. For more information, see interfaces(5).

    # The loopback network interface
    auto lo
    iface lo inet loopback

    # The primary network interface
    auto 网卡名
    iface 网卡名 inet dhcp //此处修改为 dhcp

    虚拟机的网卡还是保持桥接的模式,之前我连 ubuntu-server16.04 是这么弄的没问题
    myyou
    myyou
    OP
    Jun 29, 2016
    7
    @ICU 采用了你这种模式暂时没问题了
    Neveroldmilk
    Neveroldmilk
    Jun 29, 2016
    8
    默认没启用 SSH ,另外既然是 14.04 那就可以用 networkmanager 设置。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   997 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 19:31 · PVG 03:31 · LAX 11:31 · JFK 14:31
    ♥ Do have faith in what you're doing.