I'm trying to configure a machine (PC1) to be connected to my local network, and also have a direct connection to a second PC (PC2) plugged directly into PC1.
I ssh into PC1 and control it headlessly.
Note: - PC2 eth0 is the interface that is connected to PC1 via ethernet - PC1 enp2s0 is the interface that is connected to PC2 via ethernet - PC1 enp4s0 is the interface that is connected to local network router via ethernet
Configrure /etc/network/interfaces on PC2 to be:
# Please note that this file is written to be used with dhcpcd # For static IP, consult /etc/dhcpcd.conf and 'man dhcpcd.conf' # Include files from /etc/network/interfaces.d: source-directory /etc/network/interfaces.d auto eth0 iface eth0 inet static address 192.168.178.69 netmask 24
Configrure /etc/dhcpcd.conf on PC2:
# Inform the DHCP server of our hostname for DDNS. hostname # Use the hardware address of the interface for the Client ID. clientid # Persist interface configuration when dhcpcd exits. persistent # Rapid commit support. # Safe to enable by default because it requires the equivalent option set # on the server to actually work. option rapid_commit # A list of options to request from the DHCP server. option domain_name_servers, domain_name, domain_search, host_name option classless_static_routes # Respect the network MTU. This is applied to DHCP routes. option interface_mtu # A ServerID is required by RFC2131. require dhcp_server_identifier # generate Stable Private IPv6 Addresses based from the DUID slaac private # Example static IP configuration: interface eth0 static ip_address=192.168.178.59/24 #static ip6_address=fd51:42f8:caae:d92e::ff/64 static routers=192.168.178.1 static domain_name_servers=192.168.178.1 220.127.116.11
Configrure /etc/netplan/50-cloud-init.yaml on PC1 to be:
network: version: 2 renderer: networkd ethernets: enp0s21f0u5: dhcp4: true enp4s0: dhcp4: true enp2s0: dhcp4: false addresses: [192.168.178.69/24] gateway4: 192.168.178.58 nameservers: addresses: [18.104.22.168,22.214.171.124]
When i run ifconfig on PC1 i get:
enp0s21f0u5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.1.100 netmask 255.255.255.0 broadcast 192.168.1.255 inet6 fe80::5000:4eff:fe43:a642 prefixlen 64 scopeid 0x20<link> ether 52:00:4e:43:a6:42 txqueuelen 1000 (Ethernet) RX packets 309 bytes 29412 (29.4 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 333 bytes 53861 (53.8 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 enp2s0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500 inet6 fe80::c600:adff:fe43:96c2 prefixlen 64 scopeid 0x20<link> ether c4:00:ad:43:96:c2 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 65 bytes 10556 (10.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0x91500000-915fffff enp4s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500 inet 192.168.178.58 netmask 255.255.255.0 broadcast 192.168.178.255 inet6 fe80::c600:adff:fe43:96c3 prefixlen 64 scopeid 0x20<link> inet6 2406:e003:d8c:f201:c600:adff:fe43:96c3 prefixlen 64 scopeid 0x0<global> ether c4:00:ad:43:96:c3 txqueuelen 1000 (Ethernet) RX packets 27545 bytes 1994573 (1.9 MB) RX errors 0 dropped 2661 overruns 0 frame 0 TX packets 2486 bytes 214403 (214.4 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device memory 0x91200000-912fffff 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 453 bytes 63793 (63.7 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 453 bytes 63793 (63.7 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I can ssh fine into PC1 from another machine connected to the local network, but when i try ssh into PC2 from PC1, it is actually a ssh connection to the same PC1 machine. it seems to think that from within PC1, both 192.168.178.58 and 192.168.178.69 are directed to the local machine?
What is going on here?