在 Ubuntu 17.04 上创建别名 IP
crate alias IP on Ubuntu 17.04
我需要为我的本地机器创建别名 Ip,作为我使用的参考 https://websiteforstudents.com/switch-static-ip-address-ubuntu-17-04-17-10/
ifconfig 将我的网络接口显示为:
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.106 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::b7c0:76a:d0c0:3a7b prefixlen 64 scopeid 0x20<link>
ether 6c:71:d9:21:ff:61 txqueuelen 1000 (Ethernet)
RX packets 389087 bytes 342937114 (342.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 270723 bytes 54566302 (54.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
但是当我 运行 sudo nano /etc/network/interfaces
如参考文献中所述时,我看到不同的文件内容:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
所以我尝试手动将接口添加到 /etc/network/interfaces
:
# The primary network interface
auto wlp3s0
iface wlp3s0 inet dhcp
iface wlp3s0 inet static
address 10.254.254.254/24
但是当我 运行 sudo ifdown wlp3s0 && sudo ifup wlp3s0
时它不工作 我得到:
ifdown: interface wlp3s0 not configured
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlp3s0/6c:71:d9:21:ff:61
Sending on LPF/wlp3s0/6c:71:d9:21:ff:61
Sending on Socket/fallback
DHCPREQUEST of 192.168.1.106 on wlp3s0 to 255.255.255.255 port 67 (xid=0x4ec976a9)
DHCPACK of 192.168.1.106 from 192.168.1.1
RTNETLINK answers: File exists
bound to 192.168.1.106 -- renewal in 3106 seconds.
RTNETLINK answers: File exists
Failed to bring up wlp3s0.
我是新手,请帮我解决问题,谢谢!
别名的格式必须是 - wlp3sX:Y,其中 X 是物理网络接口号,Y 是网络接口号别名。一切都被详细描述 - http://drach.pro/blog/linux/item/71-ip-address-alias-on-centos-6-6 http://semenushkin.ru/2010/09/28/ifconfig-alias/
我需要为我的本地机器创建别名 Ip,作为我使用的参考 https://websiteforstudents.com/switch-static-ip-address-ubuntu-17-04-17-10/
ifconfig 将我的网络接口显示为:
wlp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.106 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::b7c0:76a:d0c0:3a7b prefixlen 64 scopeid 0x20<link>
ether 6c:71:d9:21:ff:61 txqueuelen 1000 (Ethernet)
RX packets 389087 bytes 342937114 (342.9 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 270723 bytes 54566302 (54.5 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
但是当我 运行 sudo nano /etc/network/interfaces
如参考文献中所述时,我看到不同的文件内容:
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
所以我尝试手动将接口添加到 /etc/network/interfaces
:
# The primary network interface
auto wlp3s0
iface wlp3s0 inet dhcp
iface wlp3s0 inet static
address 10.254.254.254/24
但是当我 运行 sudo ifdown wlp3s0 && sudo ifup wlp3s0
时它不工作 我得到:
ifdown: interface wlp3s0 not configured
Internet Systems Consortium DHCP Client 4.3.5
Copyright 2004-2016 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/wlp3s0/6c:71:d9:21:ff:61
Sending on LPF/wlp3s0/6c:71:d9:21:ff:61
Sending on Socket/fallback
DHCPREQUEST of 192.168.1.106 on wlp3s0 to 255.255.255.255 port 67 (xid=0x4ec976a9)
DHCPACK of 192.168.1.106 from 192.168.1.1
RTNETLINK answers: File exists
bound to 192.168.1.106 -- renewal in 3106 seconds.
RTNETLINK answers: File exists
Failed to bring up wlp3s0.
我是新手,请帮我解决问题,谢谢!
别名的格式必须是 - wlp3sX:Y,其中 X 是物理网络接口号,Y 是网络接口号别名。一切都被详细描述 - http://drach.pro/blog/linux/item/71-ip-address-alias-on-centos-6-6 http://semenushkin.ru/2010/09/28/ifconfig-alias/