因此,我从 Psychz Networks 的经销商那里为我的专用服务器购买了一个新 IP。这是他们给我的唯一信息:
IP: 104.206.231.109
Gateway: 104.206.231.1
Netmask: 255.255.255.128
因此,我像这样设置了我的接口文件:
# 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 p4p1
iface p4p1 inet dhcp
iface eth0 inet static
address 104.206.231.109
netmask 255.255.255.128
gateway 104.206.231.1
...然后我就跑了
services networking restart
并得到:
stop: Job failed while stopping
start: Job is already running: networking
哦,还有我的 resolv.conf:
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
# DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 8.8.8.8
search dal.us.mpgs.system
哦,这是ifconfig
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:27306645 errors:0 dropped:0 overruns:0 frame:0
TX packets:27306645 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2978675193 (2.9 GB) TX bytes:2978675193 (2.9 GB)
p4p1 Link encap:Ethernet HWaddr 00:25:90:76:c3:ba
inet addr:104.206.231.47 Bcast:104.206.231.63 Mask:255.255.255.192
inet6 addr: fe80::225:90ff:fe76:c3ba/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:18388696 errors:0 dropped:0 overruns:0 frame:0
TX packets:13534048 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6282692826 (6.2 GB) TX bytes:2823775361 (2.8 GB)
Interrupt:16 Memory:fb900000-fb920000
我该如何修复这个问题?据我所知,我的设置已经正确。
答案1
根据您的ifconfig
,您的相关界面是p4p1。我建议您将/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 p4p1
iface p4p1 inet static
address 104.206.231.109
netmask 255.255.255.128
gateway 104.206.231.1
dns-nameservers 8.8.8.8 104.206.231.1
重启界面:
sudo ifdown p4p1 && sudo ifup p4p1
您得到想要的地址了吗?
ifconfig
你能上网吗?
ping -c3 www.ubuntu.com
如果您获得了所需的地址并且 ping 返回,则一切就绪。