为什么我的计算机有时会分配两个内部 IP 地址?

为什么我的计算机有时会分配两个内部 IP 地址?

我运行 Debian 10,有时当我启动计算机时,输出hostname -I会包含三个条目:

$ hostname -I
192.168.0.13 192.168.0.2 fdaa:bbcc:ddee:0:d69a:20ff:fef8:dca8

有时它会少一个:

$ hostname -I
192.168.0.2 fdaa:bbcc:ddee:0:d69a:20ff:fef8:dca8

我不明白 192.168.0.13 是从哪里来的。这是我的 hosts 文件的内容:

$ cat /etc/hosts
127.0.0.1       localhost
127.0.1.1       desktop

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

编辑:

当仅显示 192.168.0.2 时,输出ip address

$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d4:9a:20:f8:dc:a8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.2/24 brd 192.168.0.255 scope global dynamic enp0s10
       valid_lft 3361sec preferred_lft 3361sec
    inet6 fdaa:bbcc:ddee:0:d69a:20ff:fef8:dca8/64 scope global dynamic mngtmpaddr 
       valid_lft 2006054647sec preferred_lft 2006054647sec
    inet6 fe80::d69a:20ff:fef8:dca8/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 90:84:0d:f3:85:7e brd ff:ff:ff:ff:ff:ff

2021年6月16日编辑:

当 192.168.0.13 和 192.168.0.2 显示时,输出ip address

$ ip address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether d4:9a:20:f8:dc:a8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.13/24 brd 192.168.0.255 scope global dynamic enp0s10
       valid_lft 2290sec preferred_lft 2290sec
    inet 192.168.0.2/24 brd 192.168.0.255 scope global secondary dynamic enp0s10
       valid_lft 2666sec preferred_lft 2666sec
    inet6 fdaa:bbcc:ddee:0:d69a:20ff:fef8:dca8/64 scope global dynamic mngtmpaddr 
       valid_lft 2006054625sec preferred_lft 2006054625sec
    inet6 fe80::d69a:20ff:fef8:dca8/64 scope link 
       valid_lft forever preferred_lft forever
3: wlan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 90:84:0d:f3:85:7e brd ff:ff:ff:ff:ff:ff

相关内容