我对Linux和学习很陌生。我不是建立这些系统的人,但我现在需要理解和管理它们。
在/etc/netplan中,01-netcfg.yaml和50-cloud-init.yaml都存在。
01文件是静态的显示192.168.100.30 50文件是dhcp。
当我执行ipconfig -a时,100.30地址是可见的。100.50地址在我找到的任何地方都看不见。我不需要dhcp -服务器应该设置为100.30静态IP。
我可以简单地删除50-云-init.yaml文件-或者什么是最佳实践?
ifconfig -a的结果:
docker0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 172.17.0.1 netmask 255.255.0.0 broadcast 172.17.255.255
ether 02:42:c0:4b:ea:91 txqueuelen 0 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.100.30 netmask 255.255.255.0 broadcast 192.168.100.255
inet6 fe80::215:5dff:fe00:700e prefixlen 64 scopeid 0x20<link>
ether 00:15:5d:00:70:0e txqueuelen 1000 (Ethernet)
RX packets 17211039 bytes 1688816727 (1.6 GB)
RX errors 0 dropped 4 overruns 0 frame 0
TX packets 137882 bytes 550823194 (550.8 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 11147 bytes 843462 (843.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 11147 bytes 843462 (843.4 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
@heynnema含量01-netcfg.yaml
network:
version: 2
renderer: networkd
ethernets:
eth0:
dhcp4: no
addresses: [192.168.100.30/24]
gateway4: 192.168.100.1
nameservers:
addresses: [192.168.100.26,192.168.100.19,8.8.8.8,8.8.4.4]
50-云团
# 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}
network:
ethernets:
eth0:
addresses: []
dhcp4: true
version: 2
/etc/netork/接口的内容:
# ifupdown has been replaced by netplan(5) on this system. See
# /etc/netplan for current configuration.
# To re-enable ifupdown on this system, you can run:
# sudo apt install ifupdown
发布于 2020-04-15 22:07:25
这两个文件的不同之处在于,一个使用静态IP地址,另一个使用dhcp。只要地址适合您的网络,只需使用/etc/netplan/01-netcfg.yaml
。删除/etc/netplan/50-cloud-init.yaml
。
用这个.yaml..。但是没有dhcp4和最大的3dns(逗号空间)服务器.
network:
version: 2
renderer: networkd
ethernets:
eth0:
addresses: [192.168.100.30/24]
gateway4: 192.168.100.1
nameservers:
addresses: [192.168.100.26, 192.168.100.19]
sudo netplan --debug generate
sudo netplan apply
reboot
发布于 2020-04-15 18:05:08
这两个配置yaml文件具有相同的接口名称。
第一个netplan配置文件名开始于01..。根据字符串顺序01是在50之前。所以,01-netcfg.yaml文件首先工作。
你没有DHCP服务器。
在本例中,不需要文件50-cloud-init.yaml
https://askubuntu.com/questions/1227058
复制相似问题