为什么我的电脑只有一张网卡有两个IP地址?

为什么我的电脑只有一张网卡有两个IP地址?

我的电脑只有一张网卡。

lshw -class network
WARNING: you should run this program as super-user.
  *-network                 
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:06:00.0
       logical name: enp6s0
       version: 15
       serial: 
       size: 1Gbit/s
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 driverversion=5.10.0-8-amd64 duplex=full ip=192.168.31.43 latency=0 link=yes multicast=yes port=twisted pair speed=1Gbit/s
       resources: irq:32 ioport:f000(size=256) memory:fcd04000-fcd04fff memory:fcd00000-fcd03fff
  *-network:0
       description: Ethernet interface
       physical id: 1
       logical name: anbox0
       serial:  
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=192.168.250.1 link=no multicast=yes
  *-network:1
       description: Ethernet interface
       physical id: 2
       logical name: lxcbr0
       serial:  
       capabilities: ethernet physical
       configuration: autonegotiation=off broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip=10.0.3.1 link=no multicast=yes
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

显示所有ip地址:

ip a
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: enp6s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether xxxxxxxxxxxxxxxxxxxx brd ff:ff:ff:ff:ff:ff
    inet 192.168.31.43/24 brd 192.168.31.255 scope global dynamic enp6s0
       valid_lft 37676sec preferred_lft 37676sec
    inet 192.168.31.42/24 brd 192.168.31.255 scope global secondary enp6s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2e0:70ff:fec2:2e91/64 scope link 
       valid_lft forever preferred_lft forever
3: anbox0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether   brd ff:ff:ff:ff:ff:ff
    inet 192.168.250.1/24 scope global anbox0
       valid_lft forever preferred_lft forever
    inet6 fe80::bce8:93ff:fe88:11c1/64 scope link 
       valid_lft forever preferred_lft forever
4: lxcbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether   brd ff:ff:ff:ff:ff:ff
    inet 10.0.3.1/24 brd 10.0.3.255 scope global lxcbr0
       valid_lft forever preferred_lft forever

为什么我的电脑有两个IP地址192.168.31.43和?192.168.31.42

操作系统信息:

cat  /etc/issue
Debian GNU/Linux 11 \n \l

网络配置文件:

cat  /etc/network/interfaces
source /etc/network/interfaces.d/*
auto lo
iface lo inet loopback
allow-hotplug enp6s0
iface enp6s0 inet dhcp

我的本地网络使用哪个 IP 地址?

sudo nmap -sP 192.168.31.0/24
Starting Nmap 7.80 ( https://nmap.org ) at 2021-08-21 21:41 HKT
Nmap scan report for XiaoQiang (192.168.31.1)
Host is up (0.00026s latency).
Nmap scan report for 192.168.31.42
Host is up.
Nmap scan report for 192.168.31.43
Host is up.
Nmap done: 256 IP addresses (3 hosts up) scanned in 1.98 seconds

192.168.31.1是连接互联网和内联网的路由器。

两个ip同时使用192.168.31.42192.168.31.43将一台新电脑添加到本地网络中,并结合一个简单的家庭路由器。

sudo nmap -sP 192.168.31.0/24
Starting Nmap 7.80 ( https://nmap.org ) at 2021-08-21 21:41 HKT
Nmap scan report for XiaoQiang (192.168.31.1)
Host is up (0.00026s latency).
MAC Address:  (Unknown)
Nmap scan report for 192.168.31.70
Host is up (0.000057s latency).
MAC Address: 00:E0:72:64:2C:19 (Lynk)
Nmap scan report for 192.168.31.42
Host is up.
Nmap scan report for 192.168.31.43
Host is up.
Nmap done: 256 IP addresses (4 hosts up) scanned in 1.98 seconds

新电脑的IP是192.168.31.70,尝试从192.168.31.70“192.168.31.42 and192.168.31.43”连接。

ssh [email protected]
ls  /home/debian
content1

ctrl+D ,exit the connection

ssh [email protected]
ls  /home/debian
content2

奇怪的事情发生了: content1 == content2 !两个ip同时指向同一个网卡!!

相关内容