我正在尝试在双启动笔记本电脑(Win10 和 Ubuntu Studio 14.04)上设置静态 IP。这些是设置:
sudo nano /etc/network/interfaces:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
dns-domain example.com
dns-search example.com
sudo nano /etc/NetworkManager/NetworkManager.conf:
/etc/NetworkManager/NetworkManager.conf
[main]
plugins=ifupdown,keyfile,ofono
#dns=dnsmasq
no-auto-default=54:04:A6:25:64:2E,
[ifupdown]
managed=true
(“no-auto--” 的上方和下方各有一个行空格)
ifconfig 返回以下内容:
eth0 Link encap:Ethernet HWaddr 54:04:a6:25:64:2e
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
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:312 errors:0 dropped:0 overruns:0 frame:0
TX packets:312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:29521 (29.5 KB) TX bytes:29521 (29.5 KB)
wlan0 Link encap:Ethernet HWaddr 78:92:9c:45:05:ae
inet addr:192.168.43.110 Bcast:192.168.43.255 Mask:255.255.255.0
inet6 addr: fe80::7a92:9cff:fe45:5ae/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2631 errors:0 dropped:0 overruns:0 frame:0
TX packets:2507 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1816247 (1.8 MB) TX bytes:375757 (375.7 KB)
sudo ifdown eth0 返回
`RTNETLINK answers: No such process
有专业人士给我提过什么建议,我应该尝试怎样做才能正确?目标配置是:eth0 启动/eth0 启动时互联网连接。我可以发布路由器和 GUI 网络管理器设置。
sudo ifup eth0 引发以下响应:
`RTNETLINK answers: File exists
Failed to bring up eth0.`
答案1
请尝试‘=false’并重新启动网络管理器:
sudo service network-manager restart
你的interfaces
文件看起来有点忙;我会将其修改为:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.101
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1 8.8.8.8
dns-domain example.com
dns-search example.com
然后重试:
sudo ifdown eth0 && sudo ifup -v eth0
你連線了嗎?
ping -c3 www.ubuntu.com
答案2
有几件事;NetworkManager.conf 中的 MAC 地址应为小写,并且应删除结尾的“,” 。鉴于您已将有线接口的 MAC 规定为非托管,您还应设置:
[ifupdown]
managed=false
您的文件格式interfaces
看上去没有问题。