ycs*_*tle 5 networking ubuntu ip-address
我有企业级互联网连接,需要为机器设置静态 IP 地址。我在网上搜索了一下,只找到了如何设置静态本地IP地址(比如192.168..)。我尝试了同样的技术,只设置了IP地址和网络掩码,但重新启动网络后,计算机无法连接到外界。
这就是我所做的:
1)编辑/etc/network/interfaces iface eth0 inet静态地址173.10.xxx.xx网络掩码255.255.255.252
2)编辑/etc/resolv.conf搜索wp.comcast.net名称服务器xx.xx.xx.xxx名称服务器xx.xx.xx.xxx
3)重新启动网络 sudo /etc/init.d/networking restart
现在最后一步没有报错,ifconfig显示IP地址已设置,但该服务器无法连接到外界,ping google.com并报告“未知主机google.com”。
有任何想法吗?
您缺少默认路由。
在 ubuntu 中,您需要:
gateway <IP of default route>
Run Code Online (Sandbox Code Playgroud)
这是我系统上的/etc/network/interfaces(有私有IP,但没有区别):
auto eth0
iface eth0 inet static
address 10.22.16.2
netmask 255.255.255.0
network 10.22.16.0
broadcast 10.22.16.255
gateway 10.22.16.1
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 10.21.1.21
dns-search example.com
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19109 次 |
| 最近记录: |