两个 Debian 之间的静态网络连接

两个 Debian 之间的静态网络连接

我在设置两台计算机(两台 Debian,例如 A 和 B)之间的简单静态连接时遇到了很大麻烦。原则上,我知道如何做,并且已经为计算机 B 和 C(所有 Debian)正确完成了此操作。但是,配置 A 是主要目标。每当我将 A 连接到互联网提供商的家用路由器时,网络管理器都会发现连接完全正常,因此我知道以太网卡没有问题。我相信这意味着驱动程序也没有问题。以下是一些命令的输出。我发现奇怪的是(除其他外)当将 A 插入 B 时,ethtool 中的“支持的端口”不显示任何内容(尽管当连接到互联网路由器时它会显示 TP)。我在网上查找时没有发现这种情况。

有人有什么建议或提示吗?我已经与此斗争了几个月,并且已经尝试了教程、论坛、debian 页面上的几个提示……我正在考虑安装 cent OS,看看是否更容易。

提前感谢您的任何想法。

$ update-rc.d -f dhcpd remove  # I have disabled dhcp, not sure if it is needed
$ systemctl disable NetworkManager.service  # also disabled the network manager


$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback


#auto enp2s0
allow-hotplug enp2s0
iface enp2s0 inet static
  address 192.168.10.101
  netmask 255.255.255.0
  gateway 192.169.10.100


$ cat /etc/resolv.conf
nameserver 192.169.10.100


$ ip a show eno1:

2: eno1: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
    link/ether 3c:ec:ef:10:32:42 brd ff:ff:ff:ff:ff:ff
    inet 192.168.10.101/24 brd 192.168.10.255 scope global eno1
       valid_lft forever preferred_lft forever

$ ip route show
default via 192.168.10.100 dev eno1 onlink linkdown 
192.168.10.0/24 dev eno1 proto kernel scope link src 192.168.10.101 linkdown 


$ ethtool eno1

Settings for eno1:
    Supported ports: [ ]
    Supported link modes:   1000baseT/Full 
    Supported pause frame use: Symmetric
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: Unknown!
    Duplex: Unknown! (255)
    Port: Other
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: off
    Supports Wake-on: g
    Wake-on: g
    Current message level: 0x0000000f (15)
                   drv probe link timer
    Link detected: no


$ iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

在我的计算机 B 上:

$ cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

source /etc/network/interfaces.d/*

# The loopback network interface
auto lo
iface lo inet loopback


#auto enp2s0
allow-hotplug enp2s0
iface enp2s0 inet static
  address 192.168.10.100
  netmask 255.255.255.0

$ cat /proc/sys/net/ipv4/ip_forward  # I have enabled ip forwarding
1

最后,在 A 处,如果直接插入互联网路由器:

Settings for eno1:
    Supported ports: [ TP ]
    Supported link modes:   1000baseT/Full 
    Supported pause frame use: Symmetric
    Supports auto-negotiation: Yes
    Supported FEC modes: Not reported
    Advertised link modes:  1000baseT/Full 
    Advertised pause frame use: No
    Advertised auto-negotiation: Yes
    Advertised FEC modes: Not reported
    Speed: 1000Mb/s
    Duplex: Full
    Port: Twisted Pair
    PHYAD: 0
    Transceiver: internal
    Auto-negotiation: on
    MDI-X: Unknown
    Supports Wake-on: g
    Wake-on: g
    Current message level: 0x0000000f (15)
                   drv probe link timer
    Link detected: yes

相关内容