# /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
# Source interfaces # Please check /etc/network/interfaces.d before changing this file # as interfaces may have been defined in /etc/network/interfaces.d # See LP: #1262951 source /etc/network/interfaces.d/*.cfg
而interfaces.d里只有一个文件
1 2 3 4 5 6 7 8 9 10 11
# interfaces.d/50-cloud-init.cfg # This file is generated from information provided by # the datasource. Changes to it will not persist across an instance. # To disable cloud-init's network configuration capabilities, write a file # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following: # network: {config: disabled} auto lo iface lo inet loopback
# /etc/network/interfaces.d/50-cloud-init.cfg auto lo iface lo inet loopback
auto ens3 iface ens3 inet dhcp
auto ens7 iface ens7 inet dhcp
然后,sudo ifup ens7。
1 2 3 4 5 6 7 8 9 10 11 12 13
Internet Systems Consortium DHCP Client 4.3.3 Copyright 2004-2015 Internet Systems Consortium. All rights reserved. For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/ens7/fa:16:3e:ca:fb:f5 Sending on LPF/ens7/fa:16:3e:ca:fb:f5 Sending on Socket/fallback DHCPDISCOVER on ens7 to 255.255.255.255 port 67 interval 3 (xid=0x8924d41) DHCPREQUEST of 10.1.0.8 on ens7 to 255.255.255.255 port 67 (xid=0x414d9208) DHCPOFFER of 10.1.0.8 from 10.1.0.2 DHCPACK of 10.1.0.8 from 10.1.0.2 bound to 10.1.0.8 -- renewal in 34076 seconds.