ubuntu 14.04 如何设置静态 ip?

2016-06-29 10:06:13 +08:00
 myyou

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

3242 次点击
所在节点    Ubuntu
8 条回复
ICU
2016-06-29 10:21:24 +08:00
在 Ubuntu 中装 ssh 了吗?
myyou
2016-06-29 10:29:29 +08:00
@ICU 装了,只是按照那个博客设置后,无法 ssh 登陆
zjj2008se
2016-06-29 10:45:23 +08:00
sudo apt-get install openssh-server
kozora
2016-06-29 10:52:39 +08:00
网络模式使用直接复制物理模式
然后在 /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
2016-06-29 10:58:19 +08:00
你看下你能否 ping 外网,你本地连接网络是不是 wifi 连接, wifi 连接的 vm 貌似不能设置静态 ip ,检查 ssh 的端口是不是默认的 22 ,检查防火墙是否开启
ICU
2016-06-29 14:27:38 +08:00
解决了没,要不试一下动态的 与楼上那位兄弟的一样的修改方法:
在 /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
2016-06-29 16:16:25 +08:00
@ICU 采用了你这种模式暂时没问题了
Neveroldmilk
2016-06-29 16:46:57 +08:00
默认没启用 SSH ,另外既然是 14.04 那就可以用 networkmanager 设置。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/289023

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX