Before installing /etc/network/interfaces, both ports on the PC (enp1s0 and enp2s0) could ping other IPs on the network and google. After installing /etc/network/interfaces and setting the IP address, only the static IP address will ping google and other IPs on the network. Regardless of the different combinations of static and dhcp, there is only one port that can ping other IPs on the network and google and one port that cannot ping other IPs on the network and google. If I comment out all lines in /etc/network/interfaces and reboot, both ports can ping other IPs on the network and google. I have determined that the problem stems from /etc/network/interfaces. Does anyone know how to fix this problem?
ip a output:
root@jen:~# 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: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether c4:00:ad:6f:34:7f brd ff:ff:ff:ff:ff:ff
inet 10.180.198.32/23 brd 10.180.199.255 scope global dynamic enp1s0
valid_lft 2953sec preferred_lft 2953sec
inet6 fe80::c600:adff:fe6f:347f/64 scope link
valid_lft forever preferred_lft forever
3: enp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether c4:00:ad:6f:34:80 brd ff:ff:ff:ff:ff:ff
inet 10.180.198.23/23 brd 10.180.199.255 scope global enp2s0
valid_lft forever preferred_lft forever
inet6 fe80::c600:adff:fe6f:3480/64 scope link
valid_lft forever preferred_lft forever
/etc/network/interfaces configuration:
root@jen:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d
#The loopback network interface
auto lo
iface lo inet loopback
#The primary netowrk interface
allow-hotplug enp1s0
iface enp1s0 inet dhcp
allow-hotplug enp2s0
iface enp2s0 inet static
address 10.180.198.23/23
gateway 10.180.198.1
Ping when enp1s0 port is used (no cable in enp2s0 port):
root@jen:~# ping 10.180.198.90
PING 10.180.198.90 (10.180.198.90) 56(84) bytes of data.
64 bytes from 10.180.198.90: icmp_seq=1 ttl=64 time=0.300 ms
64 bytes from 10.180.198.90: icmp_seq=2 ttl=64 time=0.477 ms
64 bytes from 10.180.198.90: icmp_seq=3 ttl=64 time=0.498 ms
64 bytes from 10.180.198.90: icmp_seq=4 ttl=64 time=0.537 ms
^C
--- 10.180.198.90 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3069ms
rtt min/avg/max/mdev = 0.300/0.453/0.537/0.090 ms
Ping when enp2s0 port is used (no cable in enp1s0 port):
root@jen:~# ping 10.180.198.90
PING 10.180.198.90 (10.180.198.90) 56(84) bytes of data.
From 10.180.198.23 icmp_seq=2 Destination Host Unreachable
From 10.180.198.23 icmp_seq=3 Destination Host Unreachable
From 10.180.198.23 icmp_seq=4 Destination Host Unreachable
^C
--- 10.180.198.90 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 5122ms pipe 3
ip route with Ubuntu configuration (both ports working as wanted):
root@jen-Default-string:~# ip route
default via 10.180.198.1 dev enp1s0 proto dhcp metric 100
default via 10.180.198.1 dev enp2s0 proto dhcp metric 101
10.180.198.0/23 dev enp1s0 proto kernel scope link src 10.180.198.21 metric 100
10.180.198.0/23 dev enp2s0 proto kernel scope link src 10.180.198.22 metric 101
169.254.0.0/16 dev enp1s0 scope link metric 1000
ip route with /etc/network/interfaces configuration:
root@jen-Default-string:~# ip route
default via 10.180.198.1 dev enp2s0 onlink
10.180.198.0/23 dev enp2s0 proto kernel scope link src 10.180.198.23
10.180.198.0/23 dev enp1s0 proto kernel scope link src 10.180.198.33
169.254.0.0/16 dev enp2s0 scope link metric 1000
enp1s0 and enp2s0 renamed in cat /var/log/kern.log:
Jun 29 08:57:02 jen-Default-string kernel: [ 0.824287] r8169 0000:02:00.0 eth1: RTL8168g/8111g, c4:00:ad:6f:34:80, XID 4c0, IRQ 127
Jun 29 08:57:02 jen-Default-string kernel: [ 0.824288] r8169 0000:02:00.0 eth1: jumbo features [frames: 9194 bytes, tx checksumming: ko]
Jun 29 08:57:02 jen-Default-string kernel: [ 0.828202] r8169 0000:01:00.0 enp1s0: renamed from eth0
Jun 29 08:57:02 jen-Default-string kernel: [ 0.851441] r8169 0000:02:00.0 enp2s0: renamed from eth1