我不知道如何获取动态 IP,所以它有时会改变。我该怎么做?
一些有帮助的输出:
:~$ ifconfig -a
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 10.0.1.44 netmask 255.255.255.0 broadcast 10.0.1.255
inet6 fe80::6d9:f5ff:fe61:993d prefixlen 64 scopeid 0x20<link>
ether 04:d9:f5:61:99:3d txqueuelen 1000 (Ethernet)
RX packets 6401 bytes 4589258 (4.5 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6549 bytes 777805 (777.8 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
ham0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1404
inet 25.73.193.214 netmask 255.0.0.0 broadcast 25.255.255.255
inet6 fe80::7879:19ff:fe49:c1d6 prefixlen 64 scopeid 0x20<link>
ether 7a:79:19:49:c1:d6 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 56 bytes 6478 (6.4 KB)
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 573 bytes 73295 (73.2 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 573 bytes 73295 (73.2 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
这是我按照教程设置的用于获取动态 IP 的文件:
~: cat /etc/netplan/01-network-manager-all.yaml
# Let NetworkManager manage all devices on this system
network:
version: 2
renderer: NetworkManager
ethernets:
enp3s0:
dhcp4: yes
dhcp6: yes